You are here

public static function FileItem::propertyDefinitions in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/file/src/Plugin/Field/FieldType/FileItem.php \Drupal\file\Plugin\Field\FieldType\FileItem::propertyDefinitions()
  2. 10 core/modules/file/src/Plugin/Field/FieldType/FileItem.php \Drupal\file\Plugin\Field\FieldType\FileItem::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

1 call to FileItem::propertyDefinitions()
ImageItem::propertyDefinitions in core/modules/image/src/Plugin/Field/FieldType/ImageItem.php
Defines field item properties.
1 method overrides FileItem::propertyDefinitions()
ImageItem::propertyDefinitions in core/modules/image/src/Plugin/Field/FieldType/ImageItem.php
Defines field item properties.

File

core/modules/file/src/Plugin/Field/FieldType/FileItem.php, line 95

Class

FileItem
Plugin implementation of the 'file' field type.

Namespace

Drupal\file\Plugin\Field\FieldType

Code

public static function propertyDefinitions(FieldStorageDefinitionInterface $field_definition) {
  $properties = parent::propertyDefinitions($field_definition);
  $properties['display'] = DataDefinition::create('boolean')
    ->setLabel(t('Display'))
    ->setDescription(t('Flag to control whether this file should be displayed when viewing content'));
  $properties['description'] = DataDefinition::create('string')
    ->setLabel(t('Description'));
  return $properties;
}