WysiwygEditor.php in Drupal 10
File
core/modules/quickedit/tests/modules/src/Plugin/InPlaceEditor/WysiwygEditor.php
View source
<?php
namespace Drupal\quickedit_test\Plugin\InPlaceEditor;
use Drupal\Core\Field\FieldItemListInterface;
use Drupal\quickedit\Plugin\InPlaceEditorBase;
class WysiwygEditor extends InPlaceEditorBase {
public function isCompatible(FieldItemListInterface $items) {
$field_definition = $items
->getFieldDefinition();
if ($field_definition
->getFieldStorageDefinition()
->getCardinality() != 1) {
return FALSE;
}
return $items[0]->format === 'full_html';
}
public function getMetadata(FieldItemListInterface $items) {
$metadata['format'] = $items[0]->format;
return $metadata;
}
public function getAttachments() {
return [
'library' => [
'quickedit_test/not-existing-wysiwyg',
],
];
}
}