You are here

public static function PluginCollectionItemBase::propertyDefinitions in Plugin 8.2

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

File

src/Plugin/Field/FieldType/PluginCollectionItemBase.php, line 117

Class

PluginCollectionItemBase
Provides a base for plugin collection field items.

Namespace

Drupal\plugin\Plugin\Field\FieldType

Code

public static function propertyDefinitions(FieldStorageDefinitionInterface $field_definition) {
  $properties['plugin_id'] = DataDefinition::create('plugin_id')
    ->setLabel(t('Plugin ID'));
  $properties['plugin_configuration'] = MapDataDefinition::create('plugin_configuration')
    ->setLabel(t('Plugin configuration'));
  $properties['plugin_instance'] = MapDataDefinition::create('plugin_instance')
    ->setLabel(t('Plugin instance'))
    ->setComputed(TRUE);
  return $properties;
}