Same name and namespace in other branches
  1. 8.9.x core/lib/Drupal/Core/Field/Plugin/Field/FieldType/StringItemBase.php \Drupal\Core\Field\Plugin\Field\FieldType\StringItemBase::propertyDefinitions()
  2. 9 core/lib/Drupal/Core/Field/Plugin/Field/FieldType/StringItemBase.php \Drupal\Core\Field\Plugin\Field\FieldType\StringItemBase::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

See also

\Drupal\Core\Field\BaseFieldDefinition

2 calls to StringItemBase::propertyDefinitions()
InternalPropertyTestFieldItem::propertyDefinitions in core/modules/system/tests/modules/entity_test/src/Plugin/Field/FieldType/InternalPropertyTestFieldItem.php
Defines field item properties.
SingleInternalPropertyTestFieldItem::propertyDefinitions in core/modules/system/tests/modules/entity_test/src/Plugin/Field/FieldType/SingleInternalPropertyTestFieldItem.php
Defines field item properties.
5 methods override StringItemBase::propertyDefinitions()
ComputedTestCacheableStringItem::propertyDefinitions in core/modules/system/tests/modules/entity_test/src/Plugin/Field/FieldType/ComputedTestCacheableStringItem.php
Defines field item properties.
InternalPropertyTestFieldItem::propertyDefinitions in core/modules/system/tests/modules/entity_test/src/Plugin/Field/FieldType/InternalPropertyTestFieldItem.php
Defines field item properties.
PasswordItem::propertyDefinitions in core/lib/Drupal/Core/Field/Plugin/Field/FieldType/PasswordItem.php
Defines field item properties.
SingleInternalPropertyTestFieldItem::propertyDefinitions in core/modules/system/tests/modules/entity_test/src/Plugin/Field/FieldType/SingleInternalPropertyTestFieldItem.php
Defines field item properties.
UriItem::propertyDefinitions in core/lib/Drupal/Core/Field/Plugin/Field/FieldType/UriItem.php
Defines field item properties.

File

core/lib/Drupal/Core/Field/Plugin/Field/FieldType/StringItemBase.php, line 27

Class

StringItemBase
Base class for string field types.

Namespace

Drupal\Core\Field\Plugin\Field\FieldType

Code

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