PlainTextEditor.php in Drupal 9
Same filename and directory in other branches
Namespace
Drupal\quickedit\Plugin\InPlaceEditorFile
core/modules/quickedit/src/Plugin/InPlaceEditor/PlainTextEditor.phpView source
<?php
namespace Drupal\quickedit\Plugin\InPlaceEditor;
use Drupal\Core\Field\FieldItemListInterface;
use Drupal\quickedit\Plugin\InPlaceEditorBase;
/**
* Defines the plain text in-place editor.
*
* @InPlaceEditor(
* id = "plain_text"
* )
*/
class PlainTextEditor extends InPlaceEditorBase {
/**
* {@inheritdoc}
*/
public function isCompatible(FieldItemListInterface $items) {
$field_definition = $items
->getFieldDefinition();
// This editor is incompatible with multivalued fields.
return $field_definition
->getFieldStorageDefinition()
->getCardinality() == 1;
}
/**
* {@inheritdoc}
*/
public function getAttachments() {
return [
'library' => [
'quickedit/quickedit.inPlaceEditor.plainText',
],
];
}
}
Classes
Name | Description |
---|---|
PlainTextEditor | Defines the plain text in-place editor. |