You are here

protected function EditorSelectionTest::getSelectedEditor in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/quickedit/tests/src/Kernel/EditorSelectionTest.php \Drupal\Tests\quickedit\Kernel\EditorSelectionTest::getSelectedEditor()

Returns the in-place editor that Quick Edit selects.

3 calls to EditorSelectionTest::getSelectedEditor()
EditorSelectionTest::testNumber in core/modules/quickedit/tests/src/Kernel/EditorSelectionTest.php
Tests a number field, with cardinality 1 and >1.
EditorSelectionTest::testText in core/modules/quickedit/tests/src/Kernel/EditorSelectionTest.php
Tests a string (plain text) field, with cardinality 1 and >1.
EditorSelectionTest::testTextWysiwyg in core/modules/quickedit/tests/src/Kernel/EditorSelectionTest.php
Tests a textual field, with text filtering, with cardinality 1 and >1, always with an Editor plugin present that supports textual fields with text filtering, but with varying text format compatibility.

File

core/modules/quickedit/tests/src/Kernel/EditorSelectionTest.php, line 39

Class

EditorSelectionTest
Tests in-place field editor selection.

Namespace

Drupal\Tests\quickedit\Kernel

Code

protected function getSelectedEditor($entity_id, $field_name, $view_mode = 'default') {
  $storage = $this->container
    ->get('entity_type.manager')
    ->getStorage('entity_test');
  $storage
    ->resetCache([
    $entity_id,
  ]);
  $entity = $storage
    ->load($entity_id);
  $items = $entity
    ->get($field_name);
  $options = \Drupal::service('entity_display.repository')
    ->getViewDisplay('entity_test', 'entity_test', $view_mode)
    ->getComponent($field_name);
  return $this->editorSelector
    ->getEditor($options['type'], $items);
}