function Image::isCompatible

Same name in other branches
  1. 9 core/modules/quickedit/src/Plugin/InPlaceEditor/Image.php \Drupal\quickedit\Plugin\InPlaceEditor\Image::isCompatible()
  2. 9 core/modules/image/src/Plugin/InPlaceEditor/Image.php \Drupal\image\Plugin\InPlaceEditor\Image::isCompatible()

Overrides InPlaceEditorInterface::isCompatible

File

core/modules/image/src/Plugin/InPlaceEditor/Image.php, line 20

Class

Image
Defines the image text in-place editor.

Namespace

Drupal\image\Plugin\InPlaceEditor

Code

public function isCompatible(FieldItemListInterface $items) {
    $field_definition = $items->getFieldDefinition();
    // This editor is only compatible with single-value image fields.
    return $field_definition->getFieldStorageDefinition()
        ->getCardinality() === 1 && $field_definition->getType() === 'image';
}

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