Version 1
[yaffs-website] / web / core / modules / system / tests / modules / entity_test / src / Plugin / Field / FieldType / ShapeItemRequired.php
diff --git a/web/core/modules/system/tests/modules/entity_test/src/Plugin/Field/FieldType/ShapeItemRequired.php b/web/core/modules/system/tests/modules/entity_test/src/Plugin/Field/FieldType/ShapeItemRequired.php
new file mode 100644 (file)
index 0000000..fb38760
--- /dev/null
@@ -0,0 +1,27 @@
+<?php
+
+namespace Drupal\entity_test\Plugin\Field\FieldType;
+
+use Drupal\Core\Field\FieldStorageDefinitionInterface;
+
+/**
+ * Defines the 'shape_required' field type.
+ *
+ * @FieldType(
+ *   id = "shape_required",
+ *   label = @Translation("Shape (required)"),
+ *   description = @Translation("Yet another dummy field type."),
+ * )
+ */
+class ShapeItemRequired extends ShapeItem {
+
+  /**
+   * {@inheritdoc}
+   */
+  public static function propertyDefinitions(FieldStorageDefinitionInterface $field_definition) {
+    $properties = parent::propertyDefinitions($field_definition);
+    $properties['shape']->setRequired(TRUE);
+    return $properties;
+  }
+
+}