public function PlainTextEditor::isCompatible in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/quickedit/src/Plugin/InPlaceEditor/PlainTextEditor.php \Drupal\quickedit\Plugin\InPlaceEditor\PlainTextEditor::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/ quickedit/ src/ Plugin/ InPlaceEditor/ PlainTextEditor.php, line 25 - Contains \Drupal\quickedit\Plugin\InPlaceEditor\PlainTextEditor.
Class
- PlainTextEditor
- Defines the plain text in-place editor.
Namespace
Drupal\quickedit\Plugin\InPlaceEditorCode
public function isCompatible(FieldItemListInterface $items) {
$field_definition = $items
->getFieldDefinition();
// This editor is incompatible with multivalued fields.
if ($field_definition
->getFieldStorageDefinition()
->getCardinality() != 1) {
return FALSE;
}
elseif (in_array($field_definition
->getType(), array(
'text',
'text_long',
'text_with_summary',
), TRUE)) {
return FALSE;
}
else {
return TRUE;
}
}