You are here

public static function RelationEndpointItem::propertyDefinitions in Relation 8

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

relation_endpoint/src/Plugin/Field/FieldType/RelationEndpointItem.php, line 33
Contains \Drupal\relation_endpoint\Plugin\Field\FieldType\RelationEndpointItem.

Class

RelationEndpointItem
Plugin implementation of the 'relation_endpoint' field type.

Namespace

Drupal\relation_endpoint\Plugin\Field\FieldType

Code

public static function propertyDefinitions(FieldStorageDefinitionInterface $field_definition) {
  $properties['entity_type'] = DataDefinition::create('string')
    ->setLabel(t('Entity_type of this relation end-point.'));
  $properties['entity_id'] = DataDefinition::create('integer')
    ->setLabel(t('Entity_id of this relation end-point.'));
  $properties['r_index'] = DataDefinition::create('integer')
    ->setLabel(t('The index of this row in this relation.'));
  return $properties;
}