class PlainTextEditor

Defines the plain text in-place editor.

Plugin annotation


@InPlaceEditor(
  id = "plain_text"
)

Hierarchy

Expanded class hierarchy of PlainTextEditor

File

core/modules/quickedit/src/Plugin/InPlaceEditor/PlainTextEditor.php, line 15

Namespace

Drupal\quickedit\Plugin\InPlaceEditor
View source
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',
      ],
    ];
  }

}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.