ShapeItemRequired.php

Same filename in other branches
  1. 8.9.x core/modules/system/tests/modules/entity_test/src/Plugin/Field/FieldType/ShapeItemRequired.php
  2. 10 core/modules/system/tests/modules/entity_test/src/Plugin/Field/FieldType/ShapeItemRequired.php
  3. 11.x core/modules/system/tests/modules/entity_test/src/Plugin/Field/FieldType/ShapeItemRequired.php

Namespace

Drupal\entity_test\Plugin\Field\FieldType

File

core/modules/system/tests/modules/entity_test/src/Plugin/Field/FieldType/ShapeItemRequired.php

View source
<?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;
    }

}

Classes

Title Deprecated Summary
ShapeItemRequired Defines the 'shape_required' field type.

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.