PlainTextEditor.php in Zircon Profile 8
File
core/modules/quickedit/src/Plugin/InPlaceEditor/PlainTextEditor.php
View source
<?php
namespace Drupal\quickedit\Plugin\InPlaceEditor;
use Drupal\Core\Field\FieldItemListInterface;
use Drupal\quickedit\Plugin\InPlaceEditorBase;
class PlainTextEditor extends InPlaceEditorBase {
public function isCompatible(FieldItemListInterface $items) {
$field_definition = $items
->getFieldDefinition();
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;
}
}
public function getAttachments() {
return array(
'library' => array(
'quickedit/quickedit.inPlaceEditor.plainText',
),
);
}
}