You are here

public static function RemoteImageItem::propertyDefinitions in Remote image 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 LinkItem::propertyDefinitions

See also

\Drupal\Core\Field\BaseFieldDefinition

File

src/Plugin/Field/FieldType/RemoteImageItem.php, line 152
Contains Drupal\remote_image\Plugin\Field\FieldType\RemoteImageField.

Class

RemoteImageItem
Plugin implementation of the 'remote_image' field type.

Namespace

Drupal\remote_image\Plugin\Field\FieldType

Code

public static function propertyDefinitions(FieldStorageDefinitionInterface $field_definition) {
  return [
    'alt' => DataDefinition::create('string')
      ->setLabel(t('Alternative text'))
      ->setDescription(t("Alternative image text, for the image's 'alt' attribute.")),
    'title' => DataDefinition::create('string')
      ->setLabel(t('Title'))
      ->setDescription(t("Image title text, for the image's 'title' attribute.")),
    'width' => DataDefinition::create('integer')
      ->setLabel(t('Width'))
      ->setDescription(t('The width of the image in pixels.')),
    'height' => DataDefinition::create('integer')
      ->setLabel(t('Height'))
      ->setDescription(t('The height of the image in pixels.')),
  ] + parent::propertyDefinitions($field_definition);
}