class SingleInternalPropertyTestFieldItem
Same name and namespace in other branches
- 11.x core/modules/system/tests/modules/entity_test/src/Plugin/Field/FieldType/SingleInternalPropertyTestFieldItem.php \Drupal\entity_test\Plugin\Field\FieldType\SingleInternalPropertyTestFieldItem
- 9 core/modules/system/tests/modules/entity_test/src/Plugin/Field/FieldType/SingleInternalPropertyTestFieldItem.php \Drupal\entity_test\Plugin\Field\FieldType\SingleInternalPropertyTestFieldItem
- main core/modules/system/tests/modules/entity_test/src/Plugin/Field/FieldType/SingleInternalPropertyTestFieldItem.php \Drupal\entity_test\Plugin\Field\FieldType\SingleInternalPropertyTestFieldItem
Defines the 'Single Internal Property' entity test field type.
This is based off of the InternalPropertyTestFieldItem test field item type, but only adds a single computed property. This tests that fields with a main property name and one internal value are flattened.
Attributes
#[FieldType(id: "single_internal_property_test", label: new TranslatableMarkup("Single Internal Property (test)"), description: new TranslatableMarkup("A field containing one string, from which one internal string is computed."), default_widget: "string_textfield", default_formatter: "string")]
Hierarchy
- class \Drupal\Core\TypedData\TypedData implements \Drupal\Core\TypedData\TypedDataInterface, \Drupal\Component\Plugin\PluginInspectionInterface uses \Drupal\Core\DependencyInjection\DependencySerializationTrait, \Drupal\Core\StringTranslation\StringTranslationTrait, \Drupal\Core\TypedData\TypedDataTrait
- class \Drupal\Core\TypedData\Plugin\DataType\Map implements \Drupal\Core\TypedData\Plugin\DataType\IteratorAggregate, \Drupal\Core\TypedData\ComplexDataInterface extends \Drupal\Core\TypedData\TypedData
- class \Drupal\Core\Field\FieldItemBase implements \Drupal\Core\Field\FieldItemInterface extends \Drupal\Core\TypedData\Plugin\DataType\Map
- class \Drupal\Core\Field\Plugin\Field\FieldType\StringItemBase extends \Drupal\Core\Field\FieldItemBase
- class \Drupal\Core\Field\Plugin\Field\FieldType\StringItem extends \Drupal\Core\Field\Plugin\Field\FieldType\StringItemBase
- class \Drupal\entity_test\Plugin\Field\FieldType\SingleInternalPropertyTestFieldItem extends \Drupal\Core\Field\Plugin\Field\FieldType\StringItem
- class \Drupal\Core\Field\Plugin\Field\FieldType\StringItem extends \Drupal\Core\Field\Plugin\Field\FieldType\StringItemBase
- class \Drupal\Core\Field\Plugin\Field\FieldType\StringItemBase extends \Drupal\Core\Field\FieldItemBase
- class \Drupal\Core\Field\FieldItemBase implements \Drupal\Core\Field\FieldItemInterface extends \Drupal\Core\TypedData\Plugin\DataType\Map
- class \Drupal\Core\TypedData\Plugin\DataType\Map implements \Drupal\Core\TypedData\Plugin\DataType\IteratorAggregate, \Drupal\Core\TypedData\ComplexDataInterface extends \Drupal\Core\TypedData\TypedData
Expanded class hierarchy of SingleInternalPropertyTestFieldItem
See also
\Drupal\entity_test\Plugin\Field\FieldType\InternalPropertyTestFieldItem
File
-
core/
modules/ system/ tests/ modules/ entity_test/ src/ Plugin/ Field/ FieldType/ SingleInternalPropertyTestFieldItem.php, line 21
Namespace
Drupal\entity_test\Plugin\Field\FieldTypeView source
class SingleInternalPropertyTestFieldItem extends StringItem {
/**
* {@inheritdoc}
*/
public static function propertyDefinitions(FieldStorageDefinitionInterface $field_definition) {
$properties = parent::propertyDefinitions($field_definition);
// Add a computed property that is internal.
$properties['internal_value'] = DataDefinition::create('string')->setLabel(new TranslatableMarkup('Computed string, internal property'))
->setComputed(TRUE)
->setClass(ComputedString::class);
return $properties;
}
}
Members
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.