Version 1
[yaffs-website] / web / core / modules / system / tests / modules / entity_test / src / Plugin / Field / FieldType / ShapeItemRequired.php
1 <?php
2
3 namespace Drupal\entity_test\Plugin\Field\FieldType;
4
5 use Drupal\Core\Field\FieldStorageDefinitionInterface;
6
7 /**
8  * Defines the 'shape_required' field type.
9  *
10  * @FieldType(
11  *   id = "shape_required",
12  *   label = @Translation("Shape (required)"),
13  *   description = @Translation("Yet another dummy field type."),
14  * )
15  */
16 class ShapeItemRequired extends ShapeItem {
17
18   /**
19    * {@inheritdoc}
20    */
21   public static function propertyDefinitions(FieldStorageDefinitionInterface $field_definition) {
22     $properties = parent::propertyDefinitions($field_definition);
23     $properties['shape']->setRequired(TRUE);
24     return $properties;
25   }
26
27 }