Implements \Drupal\edit\EditPluginInterface::getAttachments().
Overrides EditPluginInterface::getAttachments
public function getAttachments() {
global $user;
$user_format_ids = array_keys(filter_formats($user));
$manager = drupal_container()
->get('plugin.manager.editor');
$definitions = $manager
->getDefinitions();
// Filter the current user's formats to those that support inline editing.
$formats = array();
foreach ($user_format_ids as $format_id) {
$editor = editor_load($format_id);
if ($editor && isset($definitions[$editor->editor]) && isset($definitions[$editor->editor]['supports_inline_editing']) && $definitions[$editor->editor]['supports_inline_editing'] === TRUE) {
$formats[] = $format_id;
}
}
// Get the attachments for all text editors that the user might use.
$attachments = $manager
->getAttachments($formats);
// Also include editor.module's formatted text editor.
$attachments['library'][] = array(
'editor',
'edit.formattedTextEditor.editor',
);
return $attachments;
}