function SingleInternalPropertyTestFieldItem::propertyDefinitions

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

Overrides StringItemBase::propertyDefinitions

File

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

Class

SingleInternalPropertyTestFieldItem
Defines the 'Single Internal Property' entity test field type.

Namespace

Drupal\entity_test\Plugin\Field\FieldType

Code

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;
}

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