You are here

public function EditorSelector::getEditorAttachments in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/quickedit/src/EditorSelector.php \Drupal\quickedit\EditorSelector::getEditorAttachments()

Returns the attachments for all editors.

Parameters

array $editor_ids: A list of all in-place editor IDs that should be attached.

Return value

array An array of attachments, for use with #attached.

Overrides EditorSelectorInterface::getEditorAttachments

See also

\Drupal\Core\Render\AttachmentsResponseProcessorInterface::processAttachments()

File

core/modules/quickedit/src/EditorSelector.php, line 88

Class

EditorSelector
Selects an in-place editor (an InPlaceEditor plugin) for a field.

Namespace

Drupal\quickedit

Code

public function getEditorAttachments(array $editor_ids) {
  $attachments = [];
  $editor_ids = array_unique($editor_ids);

  // Editor plugins' attachments.
  foreach ($editor_ids as $editor_id) {
    $editor = $this->editorManager
      ->createInstance($editor_id);
    $attachments[] = $editor
      ->getAttachments();
  }
  return NestedArray::mergeDeepArray($attachments);
}