Skip to content
Snippets Groups Projects

#3395616 Validate preview_image on image settings configuration

#3395616 Validate preview_image on image settings configuration
3 open threads

Closes #3395616

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Wim Leers
  • Marco Villegas added 1 commit

    added 1 commit

    • fc41e21e - Rename new constraint to ImageFilePath

    Compare with previous version

  • Marco Villegas added 1 commit

    added 1 commit

    Compare with previous version

  • Marco Villegas resolved all threads

    resolved all threads

  • 1 <?php
    2
    3 namespace Drupal\Core\Validation\Plugin\Validation\Constraint;
    4
    5 use Symfony\Component\Validator\Constraints\Image;
    6 use Symfony\Component\Validator\Constraints\ImageValidator;
    7
    8 /**
    9 * Image filepath constraint.
    10 *
    11 * @Constraint(
    12 * id = "ImageFilePath",
  • 2
    3 namespace Drupal\Core\Validation\Plugin\Validation\Constraint;
    4
    5 use Symfony\Component\Validator\Constraints\Image;
    6 use Symfony\Component\Validator\Constraints\ImageValidator;
    7
    8 /**
    9 * Image filepath constraint.
    10 *
    11 * @Constraint(
    12 * id = "ImageFilePath",
    13 * label = @Translation("Image filepath", context = "Validation"),
    14 * type = { "string" }
    15 * )
    16 */
    17 class ImageFilePathConstraint extends Image {
    • Why, er...why does this constraint even exist? It doesn't appear to be adding anything that doesn't already exist in Symfony, apart from exposing the constraint to Drupal, which we could do in an alter hook... :thinking:

    • @phenaproxima Agree , I think the idea here is to support the constraint validation as a plugin that can be added to any schema.yml files and skip any validation raised by config:inspect command.

      Edited by Vakul Rai
    • I think you misunderstood @phenaproxima , @vakulrai :sweat_smile: Adam is saying he thinks this new validation constraint should not be added at all (i.e. this PHP file), and that we should instead use Symfony-provided constraint.

    • Please register or sign in to reply
  • 29 29 // These settings are not recommended...
    30 30 $this->assertTrue($config->get('allow_insecure_derivatives'));
    31 31 $this->assertTrue($config->get('suppress_itok_output'));
    32 $this->assertSame("core/modules/image/testsample.png", $config->get('preview_image'));
    32 $this->assertSame("core/modules/image/sample.png", $config->get('preview_image'));
  • Vakul Rai added 1 commit

    added 1 commit

    • f1ef7723 - 3395616: Adding the validation constraint to image schema.

    Compare with previous version

  • Please register or sign in to reply
    Loading