function ShapeItem::propertyDefinitions

Same name and namespace in other branches
  1. 10 core/modules/system/tests/modules/entity_test/src/Plugin/Field/FieldType/ShapeItem.php \Drupal\entity_test\Plugin\Field\FieldType\ShapeItem::propertyDefinitions()
  2. 9 core/modules/system/tests/modules/entity_test/src/Plugin/Field/FieldType/ShapeItem.php \Drupal\entity_test\Plugin\Field\FieldType\ShapeItem::propertyDefinitions()
  3. 8.9.x core/modules/system/tests/modules/entity_test/src/Plugin/Field/FieldType/ShapeItem.php \Drupal\entity_test\Plugin\Field\FieldType\ShapeItem::propertyDefinitions()

Defines field item properties.

Properties that are required to constitute a valid, non-empty item should be denoted with \Drupal\Core\TypedData\DataDefinition::setRequired().

Return value

\Drupal\Core\TypedData\DataDefinitionInterface[] An array of property definitions of contained properties, keyed by property name.

Overrides FieldItemInterface::propertyDefinitions

1 call to ShapeItem::propertyDefinitions()
ShapeItemRequired::propertyDefinitions in core/modules/system/tests/modules/entity_test/src/Plugin/Field/FieldType/ShapeItemRequired.php
Defines field item properties.
1 method overrides ShapeItem::propertyDefinitions()
ShapeItemRequired::propertyDefinitions in core/modules/system/tests/modules/entity_test/src/Plugin/Field/FieldType/ShapeItemRequired.php
Defines field item properties.

File

core/modules/system/tests/modules/entity_test/src/Plugin/Field/FieldType/ShapeItem.php, line 35

Class

ShapeItem
Defines the 'shape' field type.

Namespace

Drupal\entity_test\Plugin\Field\FieldType

Code

public static function propertyDefinitions(FieldStorageDefinitionInterface $field_definition) {
  $properties['shape'] = DataDefinition::create('string')->setLabel(t('Shape'));
  $properties['color'] = DataDefinition::create('string')->setLabel(t('Color'));
  return $properties;
}

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