public function WysiwygEditor::isCompatible in Drupal 10
Same name and namespace in other branches
- 8 core/modules/quickedit/tests/modules/src/Plugin/InPlaceEditor/WysiwygEditor.php \Drupal\quickedit_test\Plugin\InPlaceEditor\WysiwygEditor::isCompatible()
- 9 core/modules/quickedit/tests/modules/src/Plugin/InPlaceEditor/WysiwygEditor.php \Drupal\quickedit_test\Plugin\InPlaceEditor\WysiwygEditor::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/ tests/ modules/ src/ Plugin/ InPlaceEditor/ WysiwygEditor.php, line 20
Class
- WysiwygEditor
- Defines the 'wysiwyg' in-place editor.
Namespace
Drupal\quickedit_test\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;
}
// This editor is compatible with formatted ("rich") text fields; but only
// if there is a currently active text format and that text format is the
// 'full_html' text format.
return $items[0]->format === 'full_html';
}