You are here

public static function ComputedTestCacheableStringItem::propertyDefinitions in Drupal 9

Same name and namespace in other branches
  1. 10 core/modules/system/tests/modules/entity_test/src/Plugin/Field/FieldType/ComputedTestCacheableStringItem.php \Drupal\entity_test\Plugin\Field\FieldType\ComputedTestCacheableStringItem::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 StringItemBase::propertyDefinitions

See also

\Drupal\Core\Field\BaseFieldDefinition

File

core/modules/system/tests/modules/entity_test/src/Plugin/Field/FieldType/ComputedTestCacheableStringItem.php, line 28

Class

ComputedTestCacheableStringItem
Defines the 'string' entity field type with cacheability metadata.

Namespace

Drupal\entity_test\Plugin\Field\FieldType

Code

public static function propertyDefinitions(FieldStorageDefinitionInterface $field_definition) {
  $properties['value'] = DataDefinition::create('computed_test_cacheable_string')
    ->setLabel(new TranslatableMarkup('Text value'))
    ->setSetting('case_sensitive', $field_definition
    ->getSetting('case_sensitive'))
    ->setRequired(TRUE);
  return $properties;
}