Commit 01a3e190 authored by alexpott's avatar alexpott

Issue #2203407 by nod_, sun: Replace #attached library array values with...

Issue #2203407 by nod_, sun: Replace #attached library array values with provider-namespaced strings.
parent 1d1c63d2
......@@ -332,8 +332,8 @@ function ajax_pre_render_element($element) {
// Attach JavaScript settings to the element.
if (isset($element['#ajax']['event'])) {
$element['#attached']['library'][] = array('core', 'jquery.form');
$element['#attached']['library'][] = array('core', 'drupal.ajax');
$element['#attached']['library'][] = 'core/jquery.form';
$element['#attached']['library'][] = 'core/drupal.ajax';
$settings = $element['#ajax'];
......
......@@ -187,7 +187,7 @@ function _batch_progress_page() {
),
),
'library' => array(
array('core', 'drupal.batch'),
'core/drupal.batch',
),
),
);
......
......@@ -2473,7 +2473,7 @@ function drupal_process_attached($elements, $dependency_check = FALSE) {
// Add the libraries first.
$success = TRUE;
foreach ($elements['#attached']['library'] as $library) {
if (drupal_add_library($library[0], $library[1]) === FALSE) {
if (drupal_add_library($library) === FALSE) {
$success = FALSE;
// Exit if the dependency is missing.
if ($dependency_check) {
......@@ -2641,7 +2641,7 @@ function drupal_process_attached($elements, $dependency_check = FALSE) {
* @see form_example_states_form()
*/
function drupal_process_states(&$elements) {
$elements['#attached']['library'][] = array('core', 'drupal.states');
$elements['#attached']['library'][] = 'core/drupal.states';
// Elements of '#type' => 'item' are not actual form input elements, but we
// still want to be able to show/hide them. Since there's no actual HTML input
// element available, setting #attributes does not make sense, but a wrapper
......@@ -2660,9 +2660,7 @@ function drupal_process_states(&$elements) {
* depending module, without having to add all files of the library separately.
* Each library is only loaded once.
*
* @param $module
* The name of the module that registered the library.
* @param $name
* @param $library_name
* The name of the library to add.
* @param $every_page
* Set to TRUE if this library is added to every page on the site.
......@@ -2674,15 +2672,16 @@ function drupal_process_states(&$elements) {
* @see drupal_get_library()
* @see hook_library_info_alter()
*/
function drupal_add_library($module, $name, $every_page = NULL) {
function drupal_add_library($library_name, $every_page = NULL) {
$added = &drupal_static(__FUNCTION__, array());
list($extension, $name) = explode('/', $library_name, 2);
// Only process the library if it exists and it was not added already.
if (!isset($added[$module][$name])) {
if ($library = drupal_get_library($module, $name)) {
if (!isset($added[$extension][$name])) {
if ($library = drupal_get_library($library_name)) {
// Allow modules and themes to dynamically attach request and context
// specific data for this library; e.g., localization.
\Drupal::moduleHandler()->alter('library', $library, $module, $name);
\Drupal::moduleHandler()->alter('library', $library, $library_name);
// Add all components within the library.
$elements['#attached'] = array(
......@@ -2699,15 +2698,15 @@ function drupal_add_library($module, $name, $every_page = NULL) {
}
}
$added[$module][$name] = drupal_process_attached($elements, TRUE);
$added[$extension][$name] = drupal_process_attached($elements, TRUE);
}
else {
// Requested library does not exist.
$added[$module][$name] = FALSE;
$added[$extension][$name] = FALSE;
}
}
return $added[$module][$name];
return $added[$extension][$name];
}
/**
......@@ -2723,16 +2722,14 @@ function drupal_add_library($module, $name, $every_page = NULL) {
* - Two (or more) modules can still register the same library and use it
* without conflicts in case the libraries are loaded on certain pages only.
*
* @param $extension
* The name of the extension that registered a library.
* @param $name
* (optional) The name of a registered library to retrieve. By default, all
* libraries registered by $extension are returned.
* @param $library_name
* The name of a registered library to retrieve. By default, all
* libraries registered by the extension are returned.
*
* @return
* The definition of the requested library, if $name was passed and it exists,
* or FALSE if it does not exist. If no $name was passed, an associative array
* of libraries registered by $extension is returned (which may be empty).
* of libraries registered by the module is returned (which may be empty).
*
* @see drupal_add_library()
* @see hook_library_info_alter()
......@@ -2740,9 +2737,12 @@ function drupal_add_library($module, $name, $every_page = NULL) {
* @todo The purpose of drupal_get_*() is completely different to other page
* requisite API functions; find and use a different name.
*/
function drupal_get_library($extension, $name = NULL) {
function drupal_get_library($library_name) {
$libraries = &drupal_static(__FUNCTION__, array());
$library_info = explode('/', $library_name, 2);
$extension = $library_info[0];
$name = isset($library_info[1]) ? $library_info[1] : NULL;
if (!isset($libraries[$extension]) && ($cache = \Drupal::cache()->get('library:info:' . $extension))) {
$libraries[$extension] = $cache->data;
}
......@@ -2875,13 +2875,6 @@ function drupal_get_library($extension, $name = NULL) {
);
unset($library['settings']);
}
// @todo Convert all uses of #attached[library][]=array('provider','name')
// into #attached[library][]='provider/name' and remove this.
foreach ($library['dependencies'] as $i => $dependency) {
if (!is_array($dependency)) {
$library['dependencies'][$i] = explode('/', $dependency, 2);
}
}
}
\Drupal::cache()->set('library:info:' . $extension, $libraries[$extension], Cache::PERMANENT, array(
'extension' => array(TRUE, $extension),
......@@ -3046,7 +3039,7 @@ function drupal_attach_tabledrag(&$element, array $options) {
'limit' => $options['limit'],
);
$element['#attached']['library'][] = array('core', 'drupal.tabledrag');
$element['#attached']['library'][] = 'core/drupal.tabledrag';
$element['#attached']['js'][] = array('data' => $settings, 'type' => 'setting');
}
......@@ -3598,7 +3591,7 @@ function drupal_pre_render_links($element) {
* Pre-render callback: Attaches the dropbutton library and required markup.
*/
function drupal_pre_render_dropbutton($element) {
$element['#attached']['library'][] = array('core', 'drupal.dropbutton');
$element['#attached']['library'][] = 'core/drupal.dropbutton';
$element['#attributes']['class'][] = 'dropbutton';
if (!isset($element['#theme_wrappers'])) {
$element['#theme_wrappers'] = array();
......
......@@ -1641,7 +1641,7 @@ function theme_tableselect($variables) {
// checkboxes/radios in the first table column.
if ($element['#js_select']) {
// Add a "Select all" checkbox.
$table['#attached']['library'][] = array('core', 'drupal.tableselect');
$table['#attached']['library'][] = 'core/drupal.tableselect';
array_unshift($header, array('class' => array('select-all')));
}
else {
......@@ -1763,7 +1763,7 @@ function form_process_table($element, &$form_state) {
// Add a "Select all" checkbox column to the header.
// @todo D8: Rename into #select_all?
if ($element['#js_select']) {
$element['#attached']['library'][] = array('core', 'drupal.tableselect');
$element['#attached']['library'][] = 'core/drupal.tableselect';
array_unshift($element['#header'], array('class' => array('select-all')));
}
// Add an empty header column for radio buttons or when a "Select all"
......@@ -1992,7 +1992,7 @@ function form_process_machine_name($element, &$form_state) {
'langcode' => $language->id,
),
);
$element['#attached']['library'][] = array('core', 'drupal.machine-name');
$element['#attached']['library'][] = 'core/drupal.machine-name';
$element['#attached']['js'][] = $js_settings;
return $element;
......@@ -2085,7 +2085,7 @@ function form_pre_render_details($element) {
_form_set_attributes($element, array('form-wrapper'));
// Collapsible details.
$element['#attached']['library'][] = array('core', 'drupal.collapse');
$element['#attached']['library'][] = 'core/drupal.collapse';
if (!empty($element['#open'])) {
$element['#attributes']['open'] = 'open';
}
......@@ -2139,7 +2139,7 @@ function form_pre_render_group($element) {
if (isset($element['#group'])) {
// Contains form element summary functionalities.
$element['#attached']['library'][] = array('core', 'drupal.form');
$element['#attached']['library'][] = 'core/drupal.form';
$group = $element['#group'];
// If this element belongs to a group, but the group-holding element does
......@@ -2188,7 +2188,7 @@ function form_process_vertical_tabs($element, &$form_state) {
$element['#title_display'] = 'invisible';
}
$element['#attached']['library'][] = array('core', 'drupal.vertical-tabs');
$element['#attached']['library'][] = 'core/drupal.vertical-tabs';
// The JavaScript stores the currently selected tab in this hidden
// field so that the active tab can be restored the next time the
......@@ -2278,7 +2278,7 @@ function form_process_autocomplete($element, &$form_state) {
}
if ($access) {
$element['#attributes']['class'][] = 'form-autocomplete';
$element['#attached']['library'][] = array('core', 'drupal.autocomplete');
$element['#attached']['library'][] = 'core/drupal.autocomplete';
// Provide a data attribute for the JavaScript behavior to bind to.
$element['#attributes']['data-autocomplete-path'] = $path;
}
......
......@@ -1947,9 +1947,9 @@ function install_configure_form($form, &$form_state, &$install_state) {
drupal_set_message(t('All necessary changes to %dir and %file have been made, so you should remove write permissions to them now in order to avoid security risks. If you are unsure how to do so, consult the <a href="@handbook_url">online handbook</a>.', array('%dir' => $settings_dir, '%file' => $settings_file, '@handbook_url' => 'http://drupal.org/server-permissions')), 'warning');
}
$form['#attached']['library'][] = array('system', 'drupal.system');
$form['#attached']['library'][] = 'system/drupal.system';
// Add JavaScript time zone detection.
$form['#attached']['library'][] = array('core', 'drupal.timezone');
$form['#attached']['library'][] = 'core/drupal.timezone';
// We add these strings as settings because JavaScript translation does not
// work during installation.
$js = array('copyFieldValue' => array('edit-site-mail' => array('edit-account-mail')));
......
......@@ -1525,7 +1525,7 @@ function theme_table($variables) {
// Add sticky headers, if applicable.
if (count($header) && $sticky) {
drupal_add_library('core', 'drupal.tableheader');
drupal_add_library('core/drupal.tableheader');
// Add 'sticky-enabled' class to the table to identify it for JS.
// This is needed to target tables constructed by this function.
$attributes['class'][] = 'sticky-enabled';
......@@ -1534,7 +1534,7 @@ function theme_table($variables) {
// with the classes represented by the constants RESPONSIVE_PRIORITY_MEDIUM
// and RESPONSIVE_PRIORITY_LOW, add the tableresponsive behaviors.
if (count($header) && $responsive) {
drupal_add_library('core', 'drupal.tableresponsive');
drupal_add_library('core/drupal.tableresponsive');
// Add 'responsive-enabled' class to the table to identify it for JS.
// This is needed to target tables constructed by this function.
$attributes['class'][] = 'responsive-enabled';
......@@ -2088,7 +2088,7 @@ function template_preprocess_html(&$variables) {
drupal_add_html_head($element, $name);
}
drupal_add_library('core', 'html5shiv', TRUE);
drupal_add_library('core/html5shiv', TRUE);
$variables['page_top'][] = array('#markup' => $page->getBodyTop());
$variables['page_bottom'][] = array('#markup' => $page->getBodyBottom());
......@@ -2359,8 +2359,8 @@ function template_preprocess_maintenance_page(&$variables) {
// These are usually added from system_page_build() except maintenance.css.
// When the database is inactive it's not called so we add it here.
$default_css['library'][] = array('core', 'normalize');
$default_css['library'][] = array('system', 'maintenance');
$default_css['library'][] = 'core/normalize';
$default_css['library'][] = 'system/maintenance';
$attached = array('#attached' => $default_css);
drupal_render($attached);
$variables['messages'] = array(
......
......@@ -124,7 +124,7 @@ public function setDialogTitle($title) {
*/
public function render() {
// Add the library for handling the dialog in the response.
drupal_add_library('core', 'drupal.dialog.ajax');
drupal_add_library('core/drupal.dialog.ajax');
// For consistency ensure the modal option is set to TRUE or FALSE.
$this->dialogOptions['modal'] = isset($this->dialogOptions['modal']) && $this->dialogOptions['modal'];
......
......@@ -145,9 +145,9 @@ public function buildForm(array $form, array &$form_state) {
}
$entities = $this->load();
$form['#theme'] = array('block_list');
$form['#attached']['library'][] = array('core', 'drupal.tableheader');
$form['#attached']['library'][] = array('block', 'drupal.block');
$form['#attached']['library'][] = array('block', 'drupal.block.admin');
$form['#attached']['library'][] = 'core/drupal.tableheader';
$form['#attached']['library'][] = 'block/drupal.block';
$form['#attached']['library'][] = 'block/drupal.block.admin';
$form['#attributes']['class'][] = 'clearfix';
// Add a last region for disabled blocks.
......
......@@ -41,7 +41,7 @@ public function demo($theme) {
)
),
'library' => array(
array('block', 'drupal.block.admin'),
'block/drupal.block.admin',
),
),
);
......
......@@ -175,7 +175,7 @@ public function addFormElements(array $form, array &$form_state, NodeInterface $
'class' => array('book-outline-form'),
),
'#attached' => array(
'library' => array(array('book', 'drupal.book')),
'library' => array('book/drupal.book'),
),
'#tree' => TRUE,
);
......
......@@ -34,7 +34,7 @@ public function getFile() {
*/
public function getLibraries(Editor $editor) {
return array(
array('core', 'drupal.ajax'),
'core/drupal.ajax',
);
}
......@@ -69,7 +69,7 @@ public function getButtons() {
public function settingsForm(array $form, array &$form_state, Editor $editor) {
form_load_include($form_state, 'inc', 'editor', 'editor.admin');
$form['image_upload'] = editor_image_upload_settings_form($editor);
$form['image_upload']['#attached']['library'][] = array('ckeditor', 'drupal.ckeditor.drupalimage.admin');
$form['image_upload']['#attached']['library'][] = 'ckeditor/drupal.ckeditor.drupalimage.admin';
$form['image_upload']['#element_validate'][] = array($this, 'validateImageUploadSettings');
return $form;
}
......
......@@ -42,7 +42,7 @@ public function getDependencies(Editor $editor) {
*/
public function getLibraries(Editor $editor) {
return array(
array('ckeditor', 'drupal.ckeditor.drupalimagecaption-theme'),
'ckeditor/drupal.ckeditor.drupalimagecaption-theme',
);
}
......
......@@ -33,7 +33,7 @@ public function getFile() {
*/
public function getLibraries(Editor $editor) {
return array(
array('core', 'drupal.ajax'),
'core/drupal.ajax',
);
}
......
......@@ -79,7 +79,7 @@ public function settingsForm(array $form, array &$form_state, Editor $editor) {
'#default_value' => $config['styles'],
'#description' => t('A list of classes that will be provided in the "Styles" dropdown. Enter one class on each line in the format: element.class|Label. Example: h1.title|Title.<br />These styles should be available in your theme\'s CSS file.'),
'#attached' => array(
'library' => array(array('ckeditor', 'drupal.ckeditor.stylescombo.admin')),
'library' => array('ckeditor/drupal.ckeditor.stylescombo.admin'),
),
'#element_validate' => array(
array($this, 'validateStylesValue'),
......
......@@ -136,7 +136,7 @@ public function settingsForm(array $form, array &$form_state, EditorEntity $edit
$form['toolbar'] = array(
'#type' => 'container',
'#attached' => array(
'library' => array(array('ckeditor', 'drupal.ckeditor.admin')),
'library' => array('ckeditor/drupal.ckeditor.admin'),
'js' => array(
array(
'type' => 'setting',
......@@ -353,16 +353,14 @@ public function getLangcodes() {
*/
public function getLibraries(EditorEntity $editor) {
$libraries = array(
array('ckeditor', 'drupal.ckeditor'),
'ckeditor/drupal.ckeditor',
);
// Get the required libraries for any enabled plugins.
$enabled_plugins = array_keys($this->ckeditorPluginManager->getEnabledPluginFiles($editor));
foreach ($enabled_plugins as $plugin_id) {
$plugin = $this->ckeditorPluginManager->createInstance($plugin_id);
$additional_libraries = array_udiff($plugin->getLibraries($editor), $libraries, function($a, $b) {
return $a[0] === $b[0] && $a[1] === $b[1] ? 0 : 1;
});
$additional_libraries = array_diff($plugin->getLibraries($editor), $libraries);
$libraries = array_merge($libraries, $additional_libraries);
}
......
......@@ -202,7 +202,7 @@ function color_scheme_form($complete_form, &$form_state, $theme) {
'#default_value' => $scheme_name,
'#attached' => array(
'library' => array(
array('color', 'drupal.color'),
'color/drupal.color',
),
// Add custom CSS.
'css' => array(
......
......@@ -546,7 +546,7 @@ function comment_node_links_alter(array &$node_links, NodeInterface $node, array
'#attributes' => array('class' => array('links', 'inline')),
);
if ($view_mode == 'teaser' && \Drupal::moduleHandler()->moduleExists('history') && \Drupal::currentUser()->isAuthenticated()) {
$node_links['comment__' . $field_name]['#attached']['library'][] = array('comment', 'drupal.node-new-comments-link');
$node_links['comment__' . $field_name]['#attached']['library'][] = 'comment/drupal.node-new-comments-link';
// Embed the metadata for the "X new comments" link (if any) on this node.
$node_links['comment__' . $field_name]['#post_render_cache']['history_attach_timestamp'] = array(
......
......@@ -98,7 +98,7 @@ public function form(array $form, array &$form_state) {
$is_admin = $comment->id() && $this->currentUser->hasPermission('administer comments');
if (!$this->currentUser->isAuthenticated() && $anonymous_contact != COMMENT_ANONYMOUS_MAYNOT_CONTACT) {
$form['#attached']['library'][] = array('core', 'jquery.cookie');
$form['#attached']['library'][] = 'core/jquery.cookie';
$form['#attributes']['class'][] = 'user-info-from-cookie';
}
......
......@@ -138,9 +138,9 @@ public function buildContent(array $entities, array $displays, $view_mode, $lang
if (!isset($entity->content['#attached'])) {
$entity->content['#attached'] = array();
}
$entity->content['#attached']['library'][] = array('comment', 'drupal.comment-by-viewer');
$entity->content['#attached']['library'][] = 'comment/drupal.comment-by-viewer';
if ($this->moduleHandler->moduleExists('history') && \Drupal::currentUser()->isAuthenticated()) {
$entity->content['#attached']['library'][] = array('comment', 'drupal.comment-new-indicator');
$entity->content['#attached']['library'][] = 'comment/drupal.comment-new-indicator';
// Embed the metadata for the comment "new" indicators on this node.
$entity->content['#post_render_cache']['history_attach_timestamp'] = array(
......
......@@ -102,7 +102,7 @@ public function instanceSettingsForm(array $form, array &$form_state) {
'class' => array('comment-instance-settings-form'),
),
'#attached' => array(
'library' => array(array('comment', 'drupal.comment')),
'library' => array('comment/drupal.comment'),
),
);
$element['comment']['default_mode'] = array(
......
......@@ -76,7 +76,7 @@ public function formElement(FieldItemListInterface $items, $delta, array $elemen
'class' => array('comment-' . drupal_html_class($element['#entity_type']) . '-settings-form'),
),
'#attached' => array(
'library' => array('comment', 'drupal.comment'),
'library' => array('comment/drupal.comment'),
),
);
}
......
......@@ -155,7 +155,7 @@ public function buildForm(array $form, array &$form_state) {
}
// Add the AJAX library to the form for dialog support.
$form['#attached']['library'][] = array('core', 'drupal.ajax');
$form['#attached']['library'][] = 'core/drupal.ajax';
foreach ($storage_comparer->getChangelist() as $config_change_type => $config_files) {
if (empty($config_files)) {
......
......@@ -58,7 +58,7 @@ public function render() {
$build['table'] = $table;
$build['table']['#attributes']['class'][] = 'config-translation-entity-list';
$build['#attached']['library'][] = array('system', 'drupal.system.modules');
$build['#attached']['library'][] = 'system/drupal.system.modules';
return $build;
}
......
......@@ -180,7 +180,7 @@ public function buildForm(array $form, array &$form_state, Request $request = NU
$form_state['config_translation_language'] = $this->language;
$form_state['config_translation_source_language'] = $this->sourceLanguage;
$form['#attached']['library'][] = array('config_translation', 'drupal.config_translation.admin');
$form['#attached']['library'][] = 'config_translation/drupal.config_translation.admin';
$form['config_names'] = array(
'#type' => 'container',
......
......@@ -53,7 +53,7 @@ public function form(array $form, array &$form_state) {
'#required' => TRUE,
);
if ($user->isAnonymous()) {
$form['#attached']['library'][] = array('core', 'jquery.cookie');
$form['#attached']['library'][] = 'core/jquery.cookie';
$form['#attributes']['class'][] = 'user-info-from-cookie';
}
// Do not allow authenticated users to alter the name or e-mail values to
......
......@@ -43,7 +43,7 @@ function content_translation_field_sync_widget(FieldDefinitionInterface $field)
'#default_value' => !empty($translation_sync) ? $translation_sync : $default,
'#attached' => array(
'library' => array(
array('content_translation', 'drupal.content_translation.admin'),
'content_translation/drupal.content_translation.admin',
),
'js' => array(
array('data' => array('contentTranslationDependentOptions' => $settings), 'type' => 'setting'),
......@@ -71,7 +71,7 @@ function _content_translation_form_language_content_settings_form_alter(array &$
}
$form['entity_types']['#default_value'] = $default;
$form['#attached']['library'][] = array('content_translation', 'drupal.content_translation.admin');
$form['#attached']['library'][] = 'content_translation/drupal.content_translation.admin';
$form['#attached']['js'][] = array('data' => drupal_get_path('module', 'content_translation') . '/content_translation.admin.js', 'type' => 'file');
$dependent_options_settings = array();
......
......@@ -34,7 +34,7 @@ function contextual_toolbar() {
),
'#attached' => array(
'library' => array(
array('contextual', 'drupal.contextual-toolbar'),
'contextual/drupal.contextual-toolbar',
),
),
);
......@@ -56,7 +56,7 @@ function contextual_page_build(&$page) {
return;
}
$page['#attached']['library'][] = array('contextual', 'drupal.contextual-links');
$page['#attached']['library'][] = 'contextual/drupal.contextual-links';
}
/**
......@@ -104,7 +104,7 @@ function contextual_element_info() {
'#attributes' => array('class' => array('contextual-links')),
'#attached' => array(
'library' => array(
array('contextual', 'drupal.contextual-links'),
'contextual/drupal.contextual-links',
),
),
);
......
......@@ -42,7 +42,7 @@ function edit_page_build(&$page) {
return;
}
$page['#attached']['library'][] = array('edit', 'edit');
$page['#attached']['library'][] = 'edit/edit';
}
/**
......@@ -72,8 +72,8 @@ function edit_page_build(&$page) {
* @todo Remove this in favor of the 'stylesheets-additional' property proposed
* in https://drupal.org/node/1209958
*/
function edit_library_alter(array &$library, $extension, $name, $theme = NULL) {
if ($extension == 'edit' && $name == 'edit') {
function edit_library_alter(array &$library, $name, $theme = NULL) {
if ($name == 'edit/edit') {
// Retrieve the admin theme.
if (!isset($theme)) {
$theme = Drupal::config('system.theme')->get('admin');
......@@ -82,7 +82,7 @@ function edit_library_alter(array &$library, $extension, $name, $theme = NULL) {
$info = system_get_info('theme', $theme);
// Recurse to process base theme(s) first.
if (isset($info['base theme'])) {
edit_library_alter($library, $extension, $name, $info['base theme']);
edit_library_alter($library, $name, $info['base theme']);
}
if (isset($info['edit_stylesheets']) && is_array($info['edit_stylesheets'])) {
foreach ($info['edit_stylesheets'] as $path) {
......
......@@ -32,7 +32,7 @@ public function isCompatible(FieldItemListInterface $items) {
public function getAttachments() {
return array(
'library' => array(
array('edit', 'edit.inPlaceEditor.form'),
'edit/edit.inPlaceEditor.form',
),
);
}
......
......@@ -47,7 +47,7 @@ public function isCompatible(FieldItemListInterface $items) {
public function getAttachments() {
return array(
'library' => array(
array('edit', 'edit.inPlaceEditor.plainText'),
'edit/edit.inPlaceEditor.plainText',
),
);
}
......
......@@ -55,7 +55,7 @@ public function getMetadata(FieldItemListInterface $items) {
public function getAttachments() {
return array(
'library' => array(
array('edit_test', 'not-existing-wysiwyg'),
'edit_test/not-existing-wysiwyg',
),
);
}
......
......@@ -145,7 +145,7 @@ function editor_form_filter_format_form_alter(&$form, &$form_state) {
'#id' => 'editor-settings-wrapper',
'#attached' => array(
'library' => array(
array('editor', 'drupal.editor.admin'),
'editor/drupal.editor.admin',
),
),
);
......@@ -297,7 +297,7 @@ function editor_pre_render_format($element) {
}
// Attach Text Editor module's (this module) library.
$element['#attached']['library'][] = array('editor', 'drupal.editor');
$element['#attached']['library'][] = 'editor/drupal.editor';
// Attach attachments for all available editors.
$manager = \Drupal::service('plugin.manager.editor');
......
......@@ -41,7 +41,7 @@ public function buildForm(array $form, array &$form_state, FilterFormat $filter_
$image_element = $form_state['image_element'];
$form['#tree'] = TRUE;
$form['#attached']['library'][] = array('editor', 'drupal.editor.dialog');
$form['#attached']['library'][] = 'editor/drupal.editor.dialog';
$form['#prefix'] = '<div id="editor-image-dialog-form">';
$form['#suffix'] = '</div>';
......
......@@ -38,7 +38,7 @@ public function buildForm(array $form, array &$form_state, FilterFormat $filter_
$input = isset($form_state['input']['editor_object']) ? $form_state['input']['editor_object'] : array();
$form['#tree'] = TRUE;
$form['#attached']['library'][] = array('editor', 'drupal.editor.dialog');
$form['#attached']['library'][] = 'editor/drupal.editor.dialog';
$form['#prefix'] = '<div id="editor-link-dialog-form">';
$form['#suffix'] = '</div>';
......
......@@ -88,7 +88,7 @@ public function getAttachments() {
$attachments = $manager->getAttachments($formats);
// Also include editor.module's formatted text editor.
$attachments['library'][] = array('editor', 'edit.inPlaceEditor.formattedText');
$attachments['library'][] = 'editor/edit.inPlaceEditor.formattedText';
return $attachments;
}
......
......@@ -94,7 +94,7 @@ public function testManager() {
$this->assertIdentical(array(), $this->editorManager->getAttachments(array()), 'No attachments when one text editor is enabled and retrieving attachments for zero text formats.');
$expected = array(
'library' => array(
0 => array('edit_test', 'unicorn'),
0 => 'edit_test/unicorn',
),
'js' => array(
0 => array(
......
......@@ -58,7 +58,7 @@ function getJSSettings(EditorEntity $editor) {
*/
public function getLibraries(EditorEntity $editor) {
return array(
array('edit_test', 'unicorn'),
'edit_test/unicorn',
);
}
......
......@@ -236,7 +236,7 @@ public function buildForm(array $form, array &$form_state, $entity_type_id = NUL
$form['actions'] = array('#type' => 'actions');
$form['actions']['submit'] = array('#type' => 'submit', '#value'