X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=web%2Fcore%2Fmodules%2Fsystem%2Ftests%2Fmodules%2Fentity_test%2Fsrc%2FEntity%2FEntityTestConstraintViolation.php;fp=web%2Fcore%2Fmodules%2Fsystem%2Ftests%2Fmodules%2Fentity_test%2Fsrc%2FEntity%2FEntityTestConstraintViolation.php;h=ea23d7968ff8797e6fcd6c0a47af8c51fe1d1823;hp=e12c74a0d152584e5f06bfbe883a7b24485cf9d6;hb=af6d1fb995500ae68849458ee10d66abbdcfb252;hpb=680c79a86e3ed402f263faeac92e89fb6d9edcc0 diff --git a/web/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestConstraintViolation.php b/web/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestConstraintViolation.php index e12c74a0d..ea23d7968 100644 --- a/web/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestConstraintViolation.php +++ b/web/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestConstraintViolation.php @@ -3,6 +3,7 @@ namespace Drupal\entity_test\Entity; use Drupal\Core\Entity\EntityTypeInterface; +use Drupal\Core\Field\BaseFieldDefinition; /** * Defines the test entity class for testing entity constraint violations. @@ -39,6 +40,16 @@ class EntityTestConstraintViolation extends EntityTest { ]); $fields['name']->addConstraint('FieldWidgetConstraint', []); + // Add a field that uses a widget with a custom implementation for + // \Drupal\Core\Field\WidgetInterface::errorElement(). + $fields['test_field'] = BaseFieldDefinition::create('integer') + ->setLabel(t('Test field')) + ->setDisplayOptions('form', [ + 'type' => 'number', + 'weight' => 1, + ]) + ->addConstraint('FieldWidgetConstraint', []); + return $fields; }