function ImageItem::schema

Same name and namespace in other branches
  1. 9 core/modules/image/src/Plugin/Field/FieldType/ImageItem.php \Drupal\image\Plugin\Field\FieldType\ImageItem::schema()
  2. 8.9.x core/modules/image/src/Plugin/Field/FieldType/ImageItem.php \Drupal\image\Plugin\Field\FieldType\ImageItem::schema()
  3. 11.x core/modules/image/src/Plugin/Field/FieldType/ImageItem.php \Drupal\image\Plugin\Field\FieldType\ImageItem::schema()

Overrides FileItem::schema

File

core/modules/image/src/Plugin/Field/FieldType/ImageItem.php, line 106

Class

ImageItem
Plugin implementation of the 'image' field type.

Namespace

Drupal\image\Plugin\Field\FieldType

Code

public static function schema(FieldStorageDefinitionInterface $field_definition) {
  return [
    'columns' => [
      'target_id' => [
        'description' => 'The ID of the file entity.',
        'type' => 'int',
        'unsigned' => TRUE,
      ],
      'alt' => [
        'description' => "Alternative image text, for the image's 'alt' attribute.",
        'type' => 'varchar',
        'length' => 512,
      ],
      'title' => [
        'description' => "Image title text, for the image's 'title' attribute.",
        'type' => 'varchar',
        'length' => 1024,
      ],
      'width' => [
        'description' => 'The width of the image in pixels.',
        'type' => 'int',
        'unsigned' => TRUE,
      ],
      'height' => [
        'description' => 'The height of the image in pixels.',
        'type' => 'int',
        'unsigned' => TRUE,
      ],
    ],
    'indexes' => [
      'target_id' => [
        'target_id',
      ],
    ],
    'foreign keys' => [
      'target_id' => [
        'table' => 'file_managed',
        'columns' => [
          'target_id' => 'fid',
        ],
      ],
    ],
  ];
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.