You are here

public static function ViewfieldItem::propertyDefinitions in Viewfield 8.3

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/ViewfieldItem.php, line 79

Class

ViewfieldItem
Plugin implementation of the 'viewfield' field type.

Namespace

Drupal\viewfield\Plugin\Field\FieldType

Code

public static function propertyDefinitions(FieldStorageDefinitionInterface $field_definition) {
  $properties = parent::propertyDefinitions($field_definition);
  $properties['entity']
    ->setDescription(t('The referenced view'));
  $properties['display_id'] = DataDefinition::create('string')
    ->setLabel(t('Display ID'))
    ->setDescription(t('The view display ID'));
  $properties['arguments'] = DataDefinition::create('string')
    ->setLabel(t('Arguments'))
    ->setDescription(t('An optional comma-delimited list of arguments for the display'));
  $properties['items_to_display'] = DataDefinition::create('string')
    ->setLabel(t('Items to display'))
    ->setDescription(t('Override the number of displayed items.'));
  return $properties;
}