class WysiwygEditor
Same name in other branches
- 9 core/modules/quickedit/tests/modules/src/Plugin/InPlaceEditor/WysiwygEditor.php \Drupal\quickedit_test\Plugin\InPlaceEditor\WysiwygEditor
Defines the 'wysiwyg' in-place editor.
Plugin annotation
@InPlaceEditor(
id = "wysiwyg",
)
Hierarchy
- class \Drupal\Component\Plugin\PluginBase implements \Drupal\Component\Plugin\PluginInspectionInterface, \Drupal\Component\Plugin\DerivativeInspectionInterface
- class \Drupal\Core\Plugin\PluginBase extends \Drupal\Component\Plugin\PluginBase uses \Drupal\Core\StringTranslation\StringTranslationTrait, \Drupal\Core\DependencyInjection\DependencySerializationTrait, \Drupal\Core\Messenger\MessengerTrait
- class \Drupal\quickedit\Plugin\InPlaceEditorBase extends \Drupal\Core\Plugin\PluginBase implements \Drupal\quickedit\Plugin\InPlaceEditorInterface
- class \Drupal\quickedit_test\Plugin\InPlaceEditor\WysiwygEditor extends \Drupal\quickedit\Plugin\InPlaceEditorBase
- class \Drupal\quickedit\Plugin\InPlaceEditorBase extends \Drupal\Core\Plugin\PluginBase implements \Drupal\quickedit\Plugin\InPlaceEditorInterface
- class \Drupal\Core\Plugin\PluginBase extends \Drupal\Component\Plugin\PluginBase uses \Drupal\Core\StringTranslation\StringTranslationTrait, \Drupal\Core\DependencyInjection\DependencySerializationTrait, \Drupal\Core\Messenger\MessengerTrait
Expanded class hierarchy of WysiwygEditor
File
-
core/
modules/ quickedit/ tests/ modules/ src/ Plugin/ InPlaceEditor/ WysiwygEditor.php, line 15
Namespace
Drupal\quickedit_test\Plugin\InPlaceEditorView source
class WysiwygEditor extends InPlaceEditorBase {
/**
* {@inheritdoc}
*/
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';
}
/**
* {@inheritdoc}
*/
public function getMetadata(FieldItemListInterface $items) {
$metadata['format'] = $items[0]->format;
return $metadata;
}
/**
* {@inheritdoc}
*/
public function getAttachments() {
return [
'library' => [
'quickedit_test/not-existing-wysiwyg',
],
];
}
}
Members
Title Sort descending | Modifiers | Object type | Summary | Overriden Title | Overrides |
---|---|---|---|---|---|
PluginInspectionInterface::getPluginDefinition | public | function | Gets the definition of the plugin implementation. | 6 | |
PluginInspectionInterface::getPluginId | public | function | Gets the plugin_id of the plugin instance. | 2 | |
WysiwygEditor::getAttachments | public | function | Returns the attachments for this editor. | Overrides InPlaceEditorInterface::getAttachments | |
WysiwygEditor::getMetadata | public | function | Generates metadata that is needed specifically for this editor. | Overrides InPlaceEditorBase::getMetadata | |
WysiwygEditor::isCompatible | public | function | Checks whether this in-place editor is compatible with a given field. | Overrides InPlaceEditorInterface::isCompatible |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.