function EditorSelectionTest::getSelectedEditor
Returns the in-place editor that Quick Edit selects.
File
-
core/
modules/ quickedit/ tests/ src/ Kernel/ EditorSelectionTest.php, line 43
Class
- EditorSelectionTest
- Tests in-place field editor selection.
Namespace
Drupal\Tests\quickedit\KernelCode
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);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.