public function Image::isCompatible in Drupal 9
Same name and namespace in other branches
- 8 core/modules/image/src/Plugin/InPlaceEditor/Image.php \Drupal\image\Plugin\InPlaceEditor\Image::isCompatible()
Checks whether this in-place editor is compatible with a given field.
Parameters
\Drupal\Core\Field\FieldItemListInterface $items: The field values to be in-place edited.
Return value
bool TRUE if it is compatible, FALSE otherwise.
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\InPlaceEditorCode
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';
}