public function ImageItem::getPropertyDefinitions

Implements \Drupal\Core\TypedData\ComplexDataInterface::getPropertyDefinitions().

Overrides Map::getPropertyDefinitions

File

drupal/core/modules/image/lib/Drupal/image/Type/ImageItem.php, line 29

Class

ImageItem
Defines the 'image_field' entity field item.

Namespace

Drupal\image\Type

Code

public function getPropertyDefinitions() {
  if (!isset(static::$propertyDefinitions)) {
    static::$propertyDefinitions['fid'] = array(
      'type' => 'integer',
      'label' => t('Referenced file id.'),
    );
    static::$propertyDefinitions['alt'] = array(
      'type' => 'boolean',
      'label' => t("Alternative image text, for the image's 'alt' attribute."),
    );
    static::$propertyDefinitions['title'] = array(
      'type' => 'string',
      'label' => t("Image title text, for the image's 'title' attribute."),
    );
    static::$propertyDefinitions['width'] = array(
      'type' => 'integer',
      'label' => t('The width of the image in pixels.'),
    );
    static::$propertyDefinitions['height'] = array(
      'type' => 'integer',
      'label' => t('The height of the image in pixels.'),
    );
    static::$propertyDefinitions['entity'] = array(
      'type' => 'entity',
      'constraints' => array(
        'EntityType' => 'file',
      ),
      'label' => t('Image'),
      'description' => t('The referenced file'),
      // The entity object is computed out of the fid.
      'computed' => TRUE,
      'read-only' => FALSE,
      'settings' => array(
        'id source' => 'fid',
      ),
    );
  }
  return static::$propertyDefinitions;
}