You are here

public static function ViewsReferenceItem::propertyDefinitions in Views Reference Field 8

Same name and namespace in other branches
  1. 8.2 src/Plugin/Field/FieldType/ViewsReferenceItem.php \Drupal\viewsreference\Plugin\Field\FieldType\ViewsReferenceItem::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 EntityReferenceItem::propertyDefinitions

See also

\Drupal\Core\Field\BaseFieldDefinition

File

src/Plugin/Field/FieldType/ViewsReferenceItem.php, line 57

Class

ViewsReferenceItem
Defines the 'viewsreference' entity field type.

Namespace

Drupal\viewsreference\Plugin\Field\FieldType

Code

public static function propertyDefinitions(FieldStorageDefinitionInterface $field_definition) {
  $properties = parent::propertyDefinitions($field_definition);
  $properties['display_id'] = DataDefinition::create('string')
    ->setLabel(new TranslatableMarkup('Display Id'))
    ->setDescription(new TranslatableMarkup('The referenced display Id'));
  $properties['argument'] = DataDefinition::create('string')
    ->setLabel(new TranslatableMarkup('Argument'))
    ->setDescription(new TranslatableMarkup('An optional argument or contextual filter to apply to the View'));
  $properties['title'] = DataDefinition::create('string')
    ->setLabel(new TranslatableMarkup('Title'))
    ->setDescription(new TranslatableMarkup('Whether or not to include the View or Block title'));
  $properties['data'] = DataDefinition::create('string')
    ->setLabel(new TranslatableMarkup('Data'))
    ->setDescription(new TranslatableMarkup('Settings data for advanced use'));
  return $properties;
}