X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=web%2Fcore%2Fmodules%2Fmedia%2Ftests%2Fmodules%2Fmedia_test_source%2Fsrc%2FPlugin%2FValidation%2FConstraint%2FMediaTestConstraintValidator.php;fp=web%2Fcore%2Fmodules%2Fmedia%2Ftests%2Fmodules%2Fmedia_test_source%2Fsrc%2FPlugin%2FValidation%2FConstraint%2FMediaTestConstraintValidator.php;h=1c744430a5fb905d9c707fb3db18d9963ff93101;hp=0000000000000000000000000000000000000000;hb=9917807b03b64faf00f6a1f29dcb6eafc454efa5;hpb=aea91e65e895364e460983b890e295aa5d5540a5 diff --git a/web/core/modules/media/tests/modules/media_test_source/src/Plugin/Validation/Constraint/MediaTestConstraintValidator.php b/web/core/modules/media/tests/modules/media_test_source/src/Plugin/Validation/Constraint/MediaTestConstraintValidator.php new file mode 100644 index 000000000..1c744430a --- /dev/null +++ b/web/core/modules/media/tests/modules/media_test_source/src/Plugin/Validation/Constraint/MediaTestConstraintValidator.php @@ -0,0 +1,34 @@ +label(); + } + elseif ($value instanceof FieldItemListInterface) { + $string_to_test = $value->value; + } + else { + return; + } + + if (strpos($string_to_test, 'love Drupal') === FALSE) { + $this->context->addViolation($constraint->message); + } + } + +}