You are here

class PlainTextEditor in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/quickedit/src/Plugin/InPlaceEditor/PlainTextEditor.php \Drupal\quickedit\Plugin\InPlaceEditor\PlainTextEditor
  2. 9 core/modules/quickedit/src/Plugin/InPlaceEditor/PlainTextEditor.php \Drupal\quickedit\Plugin\InPlaceEditor\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',
      ],
    ];
  }

}

Members