diff --git a/core/includes/ajax.inc b/core/includes/ajax.inc index 59941a0a9677efaa20c8898d309c42d2c0875301..7a9847261732d28b61484c2bcd7a07a3733dd90d 100644 --- a/core/includes/ajax.inc +++ b/core/includes/ajax.inc @@ -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']; diff --git a/core/includes/batch.inc b/core/includes/batch.inc index 0366c10f7b5eb261ca50f0330ad5e9a083e3478f..daa7b2fc3ed4aebb92022b9ec4ff2eacd8f1a193 100644 --- a/core/includes/batch.inc +++ b/core/includes/batch.inc @@ -187,7 +187,7 @@ function _batch_progress_page() { ), ), 'library' => array( - array('core', 'drupal.batch'), + 'core/drupal.batch', ), ), ); diff --git a/core/includes/common.inc b/core/includes/common.inc index 4cbeb7d977cd76c261f8b4dae69804eda95bdaab..2cda0fc9c294e1b483e404ccc1fec240f7a82d5c 100644 --- a/core/includes/common.inc +++ b/core/includes/common.inc @@ -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(); diff --git a/core/includes/form.inc b/core/includes/form.inc index 710b84822ae6b1919e6c61d22ec6c1591a342f7e..f56a364618311465800278c73c2895ed8e01f5a6 100644 --- a/core/includes/form.inc +++ b/core/includes/form.inc @@ -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; } diff --git a/core/includes/install.core.inc b/core/includes/install.core.inc index 74990e1bf23942a32d7f57830f82a5a251422551..56b9965d22bce1d1d31a62b8e3df061b13a37bad 100644 --- a/core/includes/install.core.inc +++ b/core/includes/install.core.inc @@ -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'))); diff --git a/core/includes/theme.inc b/core/includes/theme.inc index 3a8ce652ffa9c4199eb45246f2744fa86a1751d1..81ecd112ed1c989333b6656b7e1c81060792065e 100644 --- a/core/includes/theme.inc +++ b/core/includes/theme.inc @@ -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( diff --git a/core/lib/Drupal/Core/Ajax/OpenDialogCommand.php b/core/lib/Drupal/Core/Ajax/OpenDialogCommand.php index 37428434fb7a7818245cc683f7dcc9d614dcc763..07d823b52c359cf0446b90aa4103a9f31da6d884 100644 --- a/core/lib/Drupal/Core/Ajax/OpenDialogCommand.php +++ b/core/lib/Drupal/Core/Ajax/OpenDialogCommand.php @@ -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']; diff --git a/core/modules/block/lib/Drupal/block/BlockListController.php b/core/modules/block/lib/Drupal/block/BlockListController.php index 413054ccedf1d407e299a059db3c32fca436948e..65db261e4a6bbeb35f0d79d6bc90eacc91909ae6 100644 --- a/core/modules/block/lib/Drupal/block/BlockListController.php +++ b/core/modules/block/lib/Drupal/block/BlockListController.php @@ -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. diff --git a/core/modules/block/lib/Drupal/block/Controller/BlockController.php b/core/modules/block/lib/Drupal/block/Controller/BlockController.php index f2ebb41e2b72492dd11acbd2d9367cdeb1b3f1fc..ebd9bc9a9eb287582a503d3d0a59e545b31727df 100644 --- a/core/modules/block/lib/Drupal/block/Controller/BlockController.php +++ b/core/modules/block/lib/Drupal/block/Controller/BlockController.php @@ -41,7 +41,7 @@ public function demo($theme) { ) ), 'library' => array( - array('block', 'drupal.block.admin'), + 'block/drupal.block.admin', ), ), ); diff --git a/core/modules/book/lib/Drupal/book/BookManager.php b/core/modules/book/lib/Drupal/book/BookManager.php index 594e7134f19bf218f5263c1b9bd184101f06eb4c..7b4f3f0fe1c6423f9f2a12fce6b552dbe2cf8dbf 100644 --- a/core/modules/book/lib/Drupal/book/BookManager.php +++ b/core/modules/book/lib/Drupal/book/BookManager.php @@ -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, ); diff --git a/core/modules/ckeditor/lib/Drupal/ckeditor/Plugin/CKEditorPlugin/DrupalImage.php b/core/modules/ckeditor/lib/Drupal/ckeditor/Plugin/CKEditorPlugin/DrupalImage.php index 8e5f0abc6ff32e2fcaf8379f82a2a195818d0dbb..04469c96012cd050bc7f261edb972ba4bf8a2f19 100644 --- a/core/modules/ckeditor/lib/Drupal/ckeditor/Plugin/CKEditorPlugin/DrupalImage.php +++ b/core/modules/ckeditor/lib/Drupal/ckeditor/Plugin/CKEditorPlugin/DrupalImage.php @@ -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; } diff --git a/core/modules/ckeditor/lib/Drupal/ckeditor/Plugin/CKEditorPlugin/DrupalImageCaption.php b/core/modules/ckeditor/lib/Drupal/ckeditor/Plugin/CKEditorPlugin/DrupalImageCaption.php index 6c01e8e0c735828e4d6c86bbcbb5d99e5e14f18a..17881cecf1838562d86bd486ff728f38dbb7c282 100644 --- a/core/modules/ckeditor/lib/Drupal/ckeditor/Plugin/CKEditorPlugin/DrupalImageCaption.php +++ b/core/modules/ckeditor/lib/Drupal/ckeditor/Plugin/CKEditorPlugin/DrupalImageCaption.php @@ -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', ); } diff --git a/core/modules/ckeditor/lib/Drupal/ckeditor/Plugin/CKEditorPlugin/DrupalLink.php b/core/modules/ckeditor/lib/Drupal/ckeditor/Plugin/CKEditorPlugin/DrupalLink.php index 91a513af75f9c29eaa791708a3fa693cdab909bf..8ce0c7a91aff7400a8350eb6e34a11728dbce6a2 100644 --- a/core/modules/ckeditor/lib/Drupal/ckeditor/Plugin/CKEditorPlugin/DrupalLink.php +++ b/core/modules/ckeditor/lib/Drupal/ckeditor/Plugin/CKEditorPlugin/DrupalLink.php @@ -33,7 +33,7 @@ public function getFile() { */ public function getLibraries(Editor $editor) { return array( - array('core', 'drupal.ajax'), + 'core/drupal.ajax', ); } diff --git a/core/modules/ckeditor/lib/Drupal/ckeditor/Plugin/CKEditorPlugin/StylesCombo.php b/core/modules/ckeditor/lib/Drupal/ckeditor/Plugin/CKEditorPlugin/StylesCombo.php index aa23043d7fb090466a321d6c6a287d99cfb450e0..9b6142d8ec24df6752bc421c53956f8073051e41 100644 --- a/core/modules/ckeditor/lib/Drupal/ckeditor/Plugin/CKEditorPlugin/StylesCombo.php +++ b/core/modules/ckeditor/lib/Drupal/ckeditor/Plugin/CKEditorPlugin/StylesCombo.php @@ -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'), diff --git a/core/modules/ckeditor/lib/Drupal/ckeditor/Plugin/Editor/CKEditor.php b/core/modules/ckeditor/lib/Drupal/ckeditor/Plugin/Editor/CKEditor.php index c10d9897689eed60835c80d966194e0b8716d2fc..2777f6775682d179cf34f067d0c908c78baa751d 100644 --- a/core/modules/ckeditor/lib/Drupal/ckeditor/Plugin/Editor/CKEditor.php +++ b/core/modules/ckeditor/lib/Drupal/ckeditor/Plugin/Editor/CKEditor.php @@ -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); } diff --git a/core/modules/color/color.module b/core/modules/color/color.module index 5fc1532bc1420ae8f168a298d1704e7d0ddea16f..7809f5f69b8aa2afaceb659fc5a3fc59c81a4c41 100644 --- a/core/modules/color/color.module +++ b/core/modules/color/color.module @@ -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( diff --git a/core/modules/comment/comment.module b/core/modules/comment/comment.module index 4d9cc75221ea363663d6960b0c44a240cfeae349..4dff2e2140d6e70386b4ff96ab081a0b412f6f68 100644 --- a/core/modules/comment/comment.module +++ b/core/modules/comment/comment.module @@ -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( diff --git a/core/modules/comment/lib/Drupal/comment/CommentFormController.php b/core/modules/comment/lib/Drupal/comment/CommentFormController.php index a3daab61e1294d1ef0a9b6537d0ef7c87526f2cd..74c147d38d19d518880c612b6b3815a22e277d70 100644 --- a/core/modules/comment/lib/Drupal/comment/CommentFormController.php +++ b/core/modules/comment/lib/Drupal/comment/CommentFormController.php @@ -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'; } diff --git a/core/modules/comment/lib/Drupal/comment/CommentViewBuilder.php b/core/modules/comment/lib/Drupal/comment/CommentViewBuilder.php index 967cca87fed527879ce8ca74908ce12a54c03da0..69ccb67657d66d449fe24b2a256dc124940becb2 100644 --- a/core/modules/comment/lib/Drupal/comment/CommentViewBuilder.php +++ b/core/modules/comment/lib/Drupal/comment/CommentViewBuilder.php @@ -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( diff --git a/core/modules/comment/lib/Drupal/comment/Plugin/Field/FieldType/CommentItem.php b/core/modules/comment/lib/Drupal/comment/Plugin/Field/FieldType/CommentItem.php index be4f79f0647c8d8d2cd82f3f61c21d60b406eed6..93dc61cc3c0f42070cfc97ce711317c834e88070 100644 --- a/core/modules/comment/lib/Drupal/comment/Plugin/Field/FieldType/CommentItem.php +++ b/core/modules/comment/lib/Drupal/comment/Plugin/Field/FieldType/CommentItem.php @@ -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( diff --git a/core/modules/comment/lib/Drupal/comment/Plugin/Field/FieldWidget/CommentWidget.php b/core/modules/comment/lib/Drupal/comment/Plugin/Field/FieldWidget/CommentWidget.php index 1ee47666ab42bb3554ad2a9da5869c4eab0ca706..a21b1f29671dc88f243634ea567d35484c85c4ee 100644 --- a/core/modules/comment/lib/Drupal/comment/Plugin/Field/FieldWidget/CommentWidget.php +++ b/core/modules/comment/lib/Drupal/comment/Plugin/Field/FieldWidget/CommentWidget.php @@ -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'), ), ); } diff --git a/core/modules/config/lib/Drupal/config/Form/ConfigSync.php b/core/modules/config/lib/Drupal/config/Form/ConfigSync.php index 64445fdf70ca0369da4220bdc0eefae9dd898bc9..22ac55fa6977a9a5eb4e10a05acf957511c4c0cb 100644 --- a/core/modules/config/lib/Drupal/config/Form/ConfigSync.php +++ b/core/modules/config/lib/Drupal/config/Form/ConfigSync.php @@ -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)) { diff --git a/core/modules/config_translation/lib/Drupal/config_translation/Controller/ConfigTranslationEntityListController.php b/core/modules/config_translation/lib/Drupal/config_translation/Controller/ConfigTranslationEntityListController.php index 8c09840337b914867b01002e90325c4cacf4fd9d..c8c495b2b4cc38ed8b66afdc6149df3029680493 100644 --- a/core/modules/config_translation/lib/Drupal/config_translation/Controller/ConfigTranslationEntityListController.php +++ b/core/modules/config_translation/lib/Drupal/config_translation/Controller/ConfigTranslationEntityListController.php @@ -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; } diff --git a/core/modules/config_translation/lib/Drupal/config_translation/Form/ConfigTranslationFormBase.php b/core/modules/config_translation/lib/Drupal/config_translation/Form/ConfigTranslationFormBase.php index 8e966eb489cfddf4a787c592ee707091b8611530..2dc072674406b3f8130d1177d5fdefd6ade4f86e 100644 --- a/core/modules/config_translation/lib/Drupal/config_translation/Form/ConfigTranslationFormBase.php +++ b/core/modules/config_translation/lib/Drupal/config_translation/Form/ConfigTranslationFormBase.php @@ -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', diff --git a/core/modules/contact/lib/Drupal/contact/MessageFormController.php b/core/modules/contact/lib/Drupal/contact/MessageFormController.php index 885a87ba65909898cca44b9023e590f6a865ad6a..143225b20887b814f633200cdbb986e00c10b78a 100644 --- a/core/modules/contact/lib/Drupal/contact/MessageFormController.php +++ b/core/modules/contact/lib/Drupal/contact/MessageFormController.php @@ -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 diff --git a/core/modules/content_translation/content_translation.admin.inc b/core/modules/content_translation/content_translation.admin.inc index 13c81eb1406291cfc0c9b3988cd405dafeec204a..ef0e4ca91bf9d7e1a34c76a6a781c20f3542912d 100644 --- a/core/modules/content_translation/content_translation.admin.inc +++ b/core/modules/content_translation/content_translation.admin.inc @@ -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(); diff --git a/core/modules/contextual/contextual.module b/core/modules/contextual/contextual.module index daaac1c53585c28836c93556740dfd7f91d65f76..a432431be6f03460e4922431c5f4989d4fb8ad3b 100644 --- a/core/modules/contextual/contextual.module +++ b/core/modules/contextual/contextual.module @@ -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', ), ), ); diff --git a/core/modules/edit/edit.module b/core/modules/edit/edit.module index 5e090cd9f8eb74f980d8d278b0b21d2c0a31fb62..1aea385c1c86a57f24fd14b1d90115d557bc89c9 100644 --- a/core/modules/edit/edit.module +++ b/core/modules/edit/edit.module @@ -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) { diff --git a/core/modules/edit/lib/Drupal/edit/Plugin/InPlaceEditor/FormEditor.php b/core/modules/edit/lib/Drupal/edit/Plugin/InPlaceEditor/FormEditor.php index 6130c33e8f7e7f4aad2242aaf2163c6a73fae295..e3b9f3b53b203c4c96303782b805887d95aac747 100644 --- a/core/modules/edit/lib/Drupal/edit/Plugin/InPlaceEditor/FormEditor.php +++ b/core/modules/edit/lib/Drupal/edit/Plugin/InPlaceEditor/FormEditor.php @@ -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', ), ); } diff --git a/core/modules/edit/lib/Drupal/edit/Plugin/InPlaceEditor/PlainTextEditor.php b/core/modules/edit/lib/Drupal/edit/Plugin/InPlaceEditor/PlainTextEditor.php index cab8f0ae6ba44b98dc675e002b6961f79b8a7e27..21b37fae07ea763054a43e261f922d4a1d457dcc 100644 --- a/core/modules/edit/lib/Drupal/edit/Plugin/InPlaceEditor/PlainTextEditor.php +++ b/core/modules/edit/lib/Drupal/edit/Plugin/InPlaceEditor/PlainTextEditor.php @@ -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', ), ); } diff --git a/core/modules/edit/tests/modules/lib/Drupal/edit_test/Plugin/InPlaceEditor/WysiwygEditor.php b/core/modules/edit/tests/modules/lib/Drupal/edit_test/Plugin/InPlaceEditor/WysiwygEditor.php index 2955aacf4c3bcc90c7c5ecedcddaac3c8a28e4a8..185ccb3b68128f72ed30f5ff141a0cb18271de4c 100644 --- a/core/modules/edit/tests/modules/lib/Drupal/edit_test/Plugin/InPlaceEditor/WysiwygEditor.php +++ b/core/modules/edit/tests/modules/lib/Drupal/edit_test/Plugin/InPlaceEditor/WysiwygEditor.php @@ -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', ), ); } diff --git a/core/modules/editor/editor.module b/core/modules/editor/editor.module index 9266911262f321933be4c047072c0961fcbc7f43..e3ff03700a44a06b7469dc2965da5460560f86fb 100644 --- a/core/modules/editor/editor.module +++ b/core/modules/editor/editor.module @@ -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'); diff --git a/core/modules/editor/lib/Drupal/editor/Form/EditorImageDialog.php b/core/modules/editor/lib/Drupal/editor/Form/EditorImageDialog.php index b3512b54dd0daa6f4084e443d0ecc9d4085ceaf5..9090e9ed06d93cf2c10064291bdb27c8d1d41535 100644 --- a/core/modules/editor/lib/Drupal/editor/Form/EditorImageDialog.php +++ b/core/modules/editor/lib/Drupal/editor/Form/EditorImageDialog.php @@ -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>'; diff --git a/core/modules/editor/lib/Drupal/editor/Form/EditorLinkDialog.php b/core/modules/editor/lib/Drupal/editor/Form/EditorLinkDialog.php index 0e76f79de916802894dd7c162ea9fc0ef138e45e..b0beb5bb3b609b2db099ec3b264ff477a244fce8 100644 --- a/core/modules/editor/lib/Drupal/editor/Form/EditorLinkDialog.php +++ b/core/modules/editor/lib/Drupal/editor/Form/EditorLinkDialog.php @@ -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>'; diff --git a/core/modules/editor/lib/Drupal/editor/Plugin/InPlaceEditor/Editor.php b/core/modules/editor/lib/Drupal/editor/Plugin/InPlaceEditor/Editor.php index 8752efbbc32ffb2b3a6a25d70b24a1af0e3960db..8520575dbfebb69d5a5bb33c2f765b0e2f496b89 100644 --- a/core/modules/editor/lib/Drupal/editor/Plugin/InPlaceEditor/Editor.php +++ b/core/modules/editor/lib/Drupal/editor/Plugin/InPlaceEditor/Editor.php @@ -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; } diff --git a/core/modules/editor/lib/Drupal/editor/Tests/EditorManagerTest.php b/core/modules/editor/lib/Drupal/editor/Tests/EditorManagerTest.php index d97f98944e670ce64cfad312092d65d9784ac8fe..a65d7ee92a7c09f2a29adc64c1cbdbb03abec92b 100644 --- a/core/modules/editor/lib/Drupal/editor/Tests/EditorManagerTest.php +++ b/core/modules/editor/lib/Drupal/editor/Tests/EditorManagerTest.php @@ -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( diff --git a/core/modules/editor/tests/modules/lib/Drupal/editor_test/Plugin/Editor/UnicornEditor.php b/core/modules/editor/tests/modules/lib/Drupal/editor_test/Plugin/Editor/UnicornEditor.php index 53d565c5ff3a1404d5e0d56f4575c83d6717affd..d5234df36e3c1ae1d39bcf404c57bfe7aca545ea 100644 --- a/core/modules/editor/tests/modules/lib/Drupal/editor_test/Plugin/Editor/UnicornEditor.php +++ b/core/modules/editor/tests/modules/lib/Drupal/editor_test/Plugin/Editor/UnicornEditor.php @@ -58,7 +58,7 @@ function getJSSettings(EditorEntity $editor) { */ public function getLibraries(EditorEntity $editor) { return array( - array('edit_test', 'unicorn'), + 'edit_test/unicorn', ); } diff --git a/core/modules/field_ui/lib/Drupal/field_ui/DisplayOverviewBase.php b/core/modules/field_ui/lib/Drupal/field_ui/DisplayOverviewBase.php index c9ce1be76637a9d71c0e1679a3427251556b5dcb..495a6e2bfc5e31e39fab8631d2c498542ba81604 100644 --- a/core/modules/field_ui/lib/Drupal/field_ui/DisplayOverviewBase.php +++ b/core/modules/field_ui/lib/Drupal/field_ui/DisplayOverviewBase.php @@ -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' => $this->t('Save')); - $form['#attached']['library'][] = array('field_ui', 'drupal.field_ui'); + $form['#attached']['library'][] = 'field_ui/drupal.field_ui'; return $form; } diff --git a/core/modules/file/file.module b/core/modules/file/file.module index ed7592fd9963a1ef6f00e7ebf5657b32686cfd1d..4514dd65ef59a67d210d9d87e1abc9291be4fffd 100644 --- a/core/modules/file/file.module +++ b/core/modules/file/file.module @@ -63,7 +63,7 @@ function file_element_info() { '#multiple' => FALSE, '#extended' => FALSE, '#attached' => array( - 'library' => array(array('file','drupal.file')), + 'library' => array('file/drupal.file'), ), ); return $types; diff --git a/core/modules/file/lib/Drupal/file/Plugin/Field/FieldType/FileItem.php b/core/modules/file/lib/Drupal/file/Plugin/Field/FieldType/FileItem.php index 81c4dfff403a72753cfbcfad2fcf18e75a2a5c1f..c6b3eb708ac45fa14dd7ca8282db39c7d6e3f7ef 100644 --- a/core/modules/file/lib/Drupal/file/Plugin/Field/FieldType/FileItem.php +++ b/core/modules/file/lib/Drupal/file/Plugin/Field/FieldType/FileItem.php @@ -97,7 +97,7 @@ public static function propertyDefinitions(FieldDefinitionInterface $field_defin public function settingsForm(array $form, array &$form_state, $has_data) { $element = array(); - $element['#attached']['library'][] = array('file', 'drupal.file'); + $element['#attached']['library'][] = 'file/drupal.file'; $element['display_field'] = array( '#type' => 'checkbox', diff --git a/core/modules/filter/filter.module b/core/modules/filter/filter.module index a97435a5cfcea7192d4f130328d9e7851cc20014..1e858adbdbb51e81a5166a1820ff964eac8499de 100644 --- a/core/modules/filter/filter.module +++ b/core/modules/filter/filter.module @@ -501,7 +501,7 @@ function filter_process_format($element) { $element['value'] += element_info($element['#base_type']); // Turn original element into a text format wrapper. - $element['#attached']['library'][] = array('filter', 'drupal.filter'); + $element['#attached']['library'][] = 'filter/drupal.filter'; // Setup child container for the text format widget. $element['format'] = array( @@ -1144,5 +1144,5 @@ function filter_filter_secure_image_alter(&$image) { * Implements hook_page_build(). */ function filter_page_build(&$page) { - $page['#attached']['library'][] = array('filter', 'caption'); + $page['#attached']['library'][] = 'filter/caption'; } diff --git a/core/modules/filter/lib/Drupal/filter/FilterFormatFormControllerBase.php b/core/modules/filter/lib/Drupal/filter/FilterFormatFormControllerBase.php index 6fa194c1aa3799719302eed450a5022201587d8b..973cbb76ce9b1d7b4107643d71f6ebb3d9149ebe 100644 --- a/core/modules/filter/lib/Drupal/filter/FilterFormatFormControllerBase.php +++ b/core/modules/filter/lib/Drupal/filter/FilterFormatFormControllerBase.php @@ -63,7 +63,7 @@ public function form(array $form, array &$form_state) { $is_fallback = ($format->id() == $this->configFactory->get('filter.settings')->get('fallback_format')); $form['#tree'] = TRUE; - $form['#attached']['library'][] = array('filter', 'drupal.filter.admin'); + $form['#attached']['library'][] = 'filter/drupal.filter.admin'; $form['name'] = array( '#type' => 'textfield', diff --git a/core/modules/filter/lib/Drupal/filter/Plugin/Filter/FilterHtml.php b/core/modules/filter/lib/Drupal/filter/Plugin/Filter/FilterHtml.php index a7c73c46a5d375a6c3baccbdd2d8923a1a9519fc..dcb931c935910720f33411ed2d4567e281bbdbc6 100644 --- a/core/modules/filter/lib/Drupal/filter/Plugin/Filter/FilterHtml.php +++ b/core/modules/filter/lib/Drupal/filter/Plugin/Filter/FilterHtml.php @@ -38,7 +38,7 @@ public function settingsForm(array $form, array &$form_state) { '#description' => t('A list of HTML tags that can be used. JavaScript event attributes, JavaScript URLs, and CSS are always stripped.'), '#attached' => array( 'library' => array( - array('filter', 'drupal.filter.filter_html.admin'), + 'filter/drupal.filter.filter_html.admin', ), ), ); diff --git a/core/modules/forum/lib/Drupal/forum/Controller/ForumController.php b/core/modules/forum/lib/Drupal/forum/Controller/ForumController.php index d503cdba84e03292fd78e0ea555ac7a5b53e19ca..277a0636f6f0c6201d83ec69e9ae0a9a421cf7ef 100644 --- a/core/modules/forum/lib/Drupal/forum/Controller/ForumController.php +++ b/core/modules/forum/lib/Drupal/forum/Controller/ForumController.php @@ -143,7 +143,7 @@ protected function build($forums, TermInterface $term, $topics = array(), $paren '#sortby' => $config->get('topics.order'), '#forums_per_page' => $config->get('topics.page_limit'), ); - $build['#attached']['library'][] = array('forum', 'forum.index'); + $build['#attached']['library'][] = 'forum/forum.index'; if (empty($term->forum_container->value)) { $build['#attached']['drupal_add_feed'][] = array('taxonomy/term/' . $term->id() . '/feed', 'RSS - ' . $term->label()); } diff --git a/core/modules/history/history.module b/core/modules/history/history.module index 5ad835eb589be9060c0204cb4dcae702ac22601d..35e3aa1d31f538c6b07f7f586f34af1ca373c871 100644 --- a/core/modules/history/history.module +++ b/core/modules/history/history.module @@ -145,7 +145,7 @@ function history_node_view_alter(&$build, EntityInterface $node, EntityViewDispl ), ), 'library' => array( - array('history', 'drupal.history'), + 'history/drupal.history', ), ); } diff --git a/core/modules/language/lib/Drupal/language/Form/ContentLanguageSettingsForm.php b/core/modules/language/lib/Drupal/language/Form/ContentLanguageSettingsForm.php index 26e0fd68d7419b6ca49c6fc7a1cfacbb40aac16a..c1c038143e0e95a55f58d1e51e23c4b13f590303 100644 --- a/core/modules/language/lib/Drupal/language/Form/ContentLanguageSettingsForm.php +++ b/core/modules/language/lib/Drupal/language/Form/ContentLanguageSettingsForm.php @@ -101,7 +101,7 @@ public function buildForm(array $form, array &$form_state) { '#labels' => $labels, '#attached' => array( 'library' => array( - array('language', 'drupal.language.admin'), + 'language/drupal.language.admin', ), ), ); diff --git a/core/modules/language/lib/Drupal/language/Form/NegotiationConfigureForm.php b/core/modules/language/lib/Drupal/language/Form/NegotiationConfigureForm.php index 93eaffb31a6722772ac64c80eabde028d84b3c67..06383eefbb78dfe802287d9042c62a43ed605351 100644 --- a/core/modules/language/lib/Drupal/language/Form/NegotiationConfigureForm.php +++ b/core/modules/language/lib/Drupal/language/Form/NegotiationConfigureForm.php @@ -206,7 +206,7 @@ protected function configureFormTable(array &$form, $type) { '#attributes' => array('class' => array('language-customization-checkbox')), '#attached' => array( 'library' => array( - array('language', 'language.admin') + 'language/language.admin' ), ), ); diff --git a/core/modules/locale/lib/Drupal/locale/Form/TranslateEditForm.php b/core/modules/locale/lib/Drupal/locale/Form/TranslateEditForm.php index d6e4b0963f1cfd827bf016dc81b263771cdfd6ce..423aebe75975ebbb0affdad6a98175f66529432b 100644 --- a/core/modules/locale/lib/Drupal/locale/Form/TranslateEditForm.php +++ b/core/modules/locale/lib/Drupal/locale/Form/TranslateEditForm.php @@ -38,7 +38,7 @@ public function buildForm(array $form, array &$form_state) { $form['#attached']['css'] = array( $path . '/css/locale.admin.css', ); - $form['#attached']['library'][] = array('locale', 'drupal.locale.admin'); + $form['#attached']['library'][] = 'locale/drupal.locale.admin'; $form['langcode'] = array( '#type' => 'value', diff --git a/core/modules/locale/lib/Drupal/locale/Tests/LocaleLibraryInfoAlterTest.php b/core/modules/locale/lib/Drupal/locale/Tests/LocaleLibraryInfoAlterTest.php index 2a512163824a4e5c3e51773460806e4fcbcf922e..30e0c8d266ffd67a57ec071b438468cc77ae2c3d 100644 --- a/core/modules/locale/lib/Drupal/locale/Tests/LocaleLibraryInfoAlterTest.php +++ b/core/modules/locale/lib/Drupal/locale/Tests/LocaleLibraryInfoAlterTest.php @@ -36,7 +36,7 @@ public static function getInfo() { * @see locale_library_info_alter() */ public function testLibraryInfoAlter() { - drupal_add_library('core', 'jquery.ui.datepicker'); + drupal_add_library('core/jquery.ui.datepicker'); $scripts = drupal_get_js(); $this->assertTrue(strpos($scripts, 'locale.datepicker.js'), 'locale.datepicker.js added to scripts.'); } diff --git a/core/modules/locale/locale.module b/core/modules/locale/locale.module index 7c3f5706c1905fab8a34fb789101ff0c9dafa73f..316013554d2620e793e2e0d04571f71b16a3fba1 100644 --- a/core/modules/locale/locale.module +++ b/core/modules/locale/locale.module @@ -638,11 +638,11 @@ function locale_js_translate(array $files = array()) { * * Provides the language support for the jQuery UI Date Picker. */ -function locale_library_alter(array &$library, $module, $name) { - if ($module == 'core' && $name == 'jquery.ui.datepicker') { +function locale_library_alter(array &$library, $name) { + if ($name == 'core/jquery.ui.datepicker') { // locale.datepicker.js should be added in the JS_LIBRARY group, so that // the behavior executes early. JS_LIBRARY is the default. - $library['dependencies'][] = array('locale', 'drupal.locale.datepicker'); + $library['dependencies'][] = 'locale/drupal.locale.datepicker'; $language_interface = \Drupal::languageManager()->getCurrentLanguage(); $settings['jquery']['ui']['datepicker'] = array( diff --git a/core/modules/locale/locale.pages.inc b/core/modules/locale/locale.pages.inc index 98f4db9858066953773f4ce1f3e10df326cd6bb4..73125fd951a48a85d003986a788b2511494310d5 100644 --- a/core/modules/locale/locale.pages.inc +++ b/core/modules/locale/locale.pages.inc @@ -161,7 +161,7 @@ function locale_translation_status_form($form, &$form_state) { '#after_build' => array('locale_translation_language_table'), ); - $form['#attached']['library'][] = array('locale', 'drupal.locale.admin'); + $form['#attached']['library'][] = 'locale/drupal.locale.admin'; $form['#attached']['css'] = array(drupal_get_path('module', 'locale') . '/css/locale.admin.css'); $form['actions'] = array('#type' => 'actions'); diff --git a/core/modules/menu/menu.module b/core/modules/menu/menu.module index 8eb1d34fc99d26b02b371c4d2d6947a58ce8dfd6..660e1df67c6ef54e064c090578cfb25966ebd2ab 100644 --- a/core/modules/menu/menu.module +++ b/core/modules/menu/menu.module @@ -477,7 +477,7 @@ function menu_form_node_form_alter(&$form, $form_state) { '#open' => !empty($link['link_title']), '#group' => 'advanced', '#attached' => array( - 'library' => array(array('menu', 'drupal.menu')), + 'library' => array('menu/drupal.menu'), ), '#tree' => TRUE, '#weight' => -2, @@ -594,7 +594,7 @@ function menu_form_node_type_form_alter(&$form, $form_state) { '#type' => 'details', '#title' => t('Menu settings'), '#attached' => array( - 'library' => array(array('menu', 'drupal.menu.admin')), + 'library' => array('menu/drupal.menu.admin'), ), '#group' => 'additional_settings', ); diff --git a/core/modules/node/lib/Drupal/node/NodeTypeFormController.php b/core/modules/node/lib/Drupal/node/NodeTypeFormController.php index 350e46db25cd5789af949ceed3a6d6694842970b..7d6bd7265243a14f7d4670bbfb651f79d64003e1 100644 --- a/core/modules/node/lib/Drupal/node/NodeTypeFormController.php +++ b/core/modules/node/lib/Drupal/node/NodeTypeFormController.php @@ -66,7 +66,7 @@ public function form(array $form, array &$form_state) { $form['additional_settings'] = array( '#type' => 'vertical_tabs', '#attached' => array( - 'library' => array(array('node', 'drupal.content_types')), + 'library' => array('node/drupal.content_types'), ), ); diff --git a/core/modules/node/node.pages.inc b/core/modules/node/node.pages.inc index e751bc270127e3932d983b282c64ca2494546c21..99f4024702092425af70f99d675a30865b1aaf47 100644 --- a/core/modules/node/node.pages.inc +++ b/core/modules/node/node.pages.inc @@ -84,7 +84,7 @@ function template_preprocess_node_preview(&$variables) { // Render trimmed teaser version of the post. $node_teaser = node_view($node, 'teaser'); - $node_teaser['#attached']['library'][] = array('node', 'drupal.node.preview'); + $node_teaser['#attached']['library'][] = 'node/drupal.node.preview'; $variables['teaser'] = $node_teaser; // Render full version of the post. $node_full = node_view($node, 'full'); diff --git a/core/modules/path/path.module b/core/modules/path/path.module index 20d9fae9113eb8083d67d6297b5ccaf6ada5127f..704f9a2bc0d69c5b1afe045e142e7f5b487ea731 100644 --- a/core/modules/path/path.module +++ b/core/modules/path/path.module @@ -104,7 +104,7 @@ function path_form_node_form_alter(&$form, $form_state) { 'class' => array('path-form'), ), '#attached' => array( - 'library' => array(array('path', 'drupal.path')), + 'library' => array('path/drupal.path'), ), '#access' => $account->hasPermission('create url aliases') || $account->hasPermission('administer url aliases'), '#weight' => 30, diff --git a/core/modules/picture/lib/Drupal/picture/Plugin/Field/FieldFormatter/PictureFormatter.php b/core/modules/picture/lib/Drupal/picture/Plugin/Field/FieldFormatter/PictureFormatter.php index 403cf528b11167da3d1400432d3aa48a33245a31..a6d3b9c83dc18b1e311356ac4d03eebabafade34 100644 --- a/core/modules/picture/lib/Drupal/picture/Plugin/Field/FieldFormatter/PictureFormatter.php +++ b/core/modules/picture/lib/Drupal/picture/Plugin/Field/FieldFormatter/PictureFormatter.php @@ -172,7 +172,7 @@ public function viewElements(FieldItemListInterface $items) { $elements[$delta] = array( '#theme' => 'picture_formatter', '#attached' => array('library' => array( - array('core', 'picturefill'), + 'core/picturefill', )), '#item' => $item, '#image_style' => $fallback_image_style, diff --git a/core/modules/shortcut/shortcut.admin.inc b/core/modules/shortcut/shortcut.admin.inc index 8e8b7218778483d9d20bbd410704f4f6b6fca0b9..3408d834c5f1927ae15966d016682522a52917a7 100644 --- a/core/modules/shortcut/shortcut.admin.inc +++ b/core/modules/shortcut/shortcut.admin.inc @@ -92,7 +92,7 @@ function shortcut_set_switch($form, &$form_state, $account = NULL) { } $form['#attached'] = array( - 'library' => array(array('shortcut', 'drupal.shortcut.admin')), + 'library' => array('shortcut/drupal.shortcut.admin'), ); $form['actions'] = array('#type' => 'actions'); diff --git a/core/modules/shortcut/shortcut.module b/core/modules/shortcut/shortcut.module index a97b447e7878f366e1bc3cbb98a79b028bb9d952..ba0b04a5083b2684b277f5d00f393b3b8bbd9aa0 100644 --- a/core/modules/shortcut/shortcut.module +++ b/core/modules/shortcut/shortcut.module @@ -412,7 +412,7 @@ function shortcut_preprocess_page(&$variables) { $variables['title_suffix']['add_or_remove_shortcut'] = array( '#attached' => array( 'library' => array( - array('shortcut', 'drupal.shortcut'), + 'shortcut/drupal.shortcut', ), ), '#prefix' => '<div class="add-or-remove-shortcuts ' . $link_mode . '-shortcut">', @@ -465,7 +465,7 @@ function shortcut_toolbar() { '#weight' => -10, '#attached' => array( 'library' => array( - array('shortcut', 'drupal.shortcut'), + 'shortcut/drupal.shortcut', ), ), ); diff --git a/core/modules/simpletest/lib/Drupal/simpletest/Form/SimpletestTestForm.php b/core/modules/simpletest/lib/Drupal/simpletest/Form/SimpletestTestForm.php index 85dc889878c2fb28d016adf2111580e739b70a5f..18d76804dea4cc16bed7216c954f3156cf0ff23f 100644 --- a/core/modules/simpletest/lib/Drupal/simpletest/Form/SimpletestTestForm.php +++ b/core/modules/simpletest/lib/Drupal/simpletest/Form/SimpletestTestForm.php @@ -58,7 +58,7 @@ public function buildForm(array $form, array &$form_state) { '#empty' => $this->t('No tests to display.'), '#attached' => array( 'library' => array( - array('simpletest', 'drupal.simpletest'), + 'simpletest/drupal.simpletest', ), ), ); diff --git a/core/modules/statistics/statistics.module b/core/modules/statistics/statistics.module index 9e780db1f6a2c7f8973dfdd7fd245b6eedae60e3..7e198f7d74e980ca4022a4823f1ef67956adb5e2 100644 --- a/core/modules/statistics/statistics.module +++ b/core/modules/statistics/statistics.module @@ -50,7 +50,7 @@ function statistics_permission() { */ function statistics_node_view(EntityInterface $node, EntityViewDisplayInterface $display, $view_mode) { if (!$node->isNew() && $view_mode == 'full' && node_is_page($node) && empty($node->in_preview)) { - $node->content['statistics_content_counter']['#attached']['library'][] = array('statistics', 'drupal.statistics'); + $node->content['statistics_content_counter']['#attached']['library'][] = 'statistics/drupal.statistics'; $settings = array('data' => array('nid' => $node->id()), 'url' => url(drupal_get_path('module', 'statistics') . '/statistics.php')); $node->content['statistics_content_counter']['#attached']['js'][] = array( 'data' => array('statistics' => $settings), diff --git a/core/modules/system/lib/Drupal/system/Form/ModulesListForm.php b/core/modules/system/lib/Drupal/system/Form/ModulesListForm.php index 15d5eafedda1203b5f1658d1b85f92d700d9b1e3..ee3f145e7110da3a2912d7ac131aa37d350ffca5 100644 --- a/core/modules/system/lib/Drupal/system/Form/ModulesListForm.php +++ b/core/modules/system/lib/Drupal/system/Form/ModulesListForm.php @@ -161,7 +161,7 @@ public function buildForm(array $form, array &$form_state) { // Lastly, sort all packages by title. uasort($form['modules'], 'element_sort_by_title'); - $form['#attached']['library'][] = array('system', 'drupal.system.modules'); + $form['#attached']['library'][] = 'system/drupal.system.modules'; $form['actions'] = array('#type' => 'actions'); $form['actions']['submit'] = array( '#type' => 'submit', diff --git a/core/modules/system/lib/Drupal/system/Form/PerformanceForm.php b/core/modules/system/lib/Drupal/system/Form/PerformanceForm.php index 6e7d9d666d1931f1ccd6915e584001723b32c9a6..fe689d07858a31ee27f116fa7ec586c781551389 100644 --- a/core/modules/system/lib/Drupal/system/Form/PerformanceForm.php +++ b/core/modules/system/lib/Drupal/system/Form/PerformanceForm.php @@ -58,7 +58,7 @@ public function getFormId() { * {@inheritdoc} */ public function buildForm(array $form, array &$form_state) { - $form['#attached']['library'][] = array('system', 'drupal.system'); + $form['#attached']['library'][] = 'system/drupal.system'; $config = $this->configFactory->get('system.performance'); diff --git a/core/modules/system/lib/Drupal/system/Plugin/views/field/BulkForm.php b/core/modules/system/lib/Drupal/system/Plugin/views/field/BulkForm.php index ad784e3d9bf7dc79881bd9d9d1c9e9b94113ca0c..09684883d8513d14b51d645fdf880ca002e6d892 100644 --- a/core/modules/system/lib/Drupal/system/Plugin/views/field/BulkForm.php +++ b/core/modules/system/lib/Drupal/system/Plugin/views/field/BulkForm.php @@ -162,7 +162,7 @@ public function preRender(&$values) { */ public function viewsForm(&$form, &$form_state) { // Add the tableselect javascript. - $form['#attached']['library'][] = array('core', 'drupal.tableselect'); + $form['#attached']['library'][] = 'core/drupal.tableselect'; // Only add the bulk form options and buttons if there are results. if (!empty($this->view->result)) { diff --git a/core/modules/system/lib/Drupal/system/Tests/Common/JavaScriptTest.php b/core/modules/system/lib/Drupal/system/Tests/Common/JavaScriptTest.php index 3cd5e57b04d94efd881f6c92792f5c15e37e1f95..bdb091073364492082eb31e11232fec74d06d043 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Common/JavaScriptTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Common/JavaScriptTest.php @@ -80,7 +80,7 @@ function testAddFile() { */ function testAddSetting() { // Add a file in order to test default settings. - drupal_add_library('core', 'drupalSettings'); + drupal_add_library('core/drupalSettings'); $javascript = _drupal_add_js(); $last_settings = reset($javascript['settings']['data']); $this->assertTrue(array_key_exists('currentPath', $last_settings['path']), 'The current path JavaScript setting is set correctly.'); @@ -106,7 +106,7 @@ function testAddExternal() { function testAttributes() { $default_query_string = $this->container->get('state')->get('system.css_js_query_string') ?: '0'; - drupal_add_library('core', 'drupal'); + drupal_add_library('core/drupal'); _drupal_add_js('http://example.com/script.js', array('attributes' => array('defer' => 'defer'))); _drupal_add_js('core/misc/collapse.js', array('attributes' => array('defer' => 'defer'))); $javascript = drupal_get_js(); @@ -127,7 +127,7 @@ function testAggregatedAttributes() { $default_query_string = $this->container->get('state')->get('system.css_js_query_string') ?: '0'; - drupal_add_library('core', 'drupal'); + drupal_add_library('core/drupal'); _drupal_add_js('http://example.com/script.js', array('attributes' => array('defer' => 'defer'))); _drupal_add_js('core/misc/collapse.js', array('attributes' => array('defer' => 'defer'))); $javascript = drupal_get_js(); @@ -143,7 +143,7 @@ function testAggregatedAttributes() { * Tests drupal_get_js() for JavaScript settings. */ function testHeaderSetting() { - drupal_add_library('core', 'drupalSettings'); + drupal_add_library('core/drupalSettings'); $javascript = drupal_get_js('header'); $this->assertTrue(strpos($javascript, 'basePath') > 0, 'Rendered JavaScript header returns basePath setting.'); @@ -205,7 +205,7 @@ function testHeaderSetting() { * Tests to see if resetting the JavaScript empties the cache. */ function testReset() { - drupal_add_library('core', 'drupal'); + drupal_add_library('core/drupal'); _drupal_add_js('core/misc/collapse.js'); drupal_static_reset('_drupal_add_js'); $this->assertEqual(array(), _drupal_add_js(), 'Resetting the JavaScript correctly empties the cache.'); @@ -215,7 +215,7 @@ function testReset() { * Tests adding inline scripts. */ function testAddInline() { - drupal_add_library('core', 'jquery'); + drupal_add_library('core/jquery'); $inline = 'jQuery(function () { });'; $javascript = _drupal_add_js($inline, array('type' => 'inline', 'scope' => 'footer')); $this->assertTrue(array_key_exists('core/assets/vendor/jquery/jquery.js', $javascript), 'jQuery is added when inline scripts are added.'); @@ -227,7 +227,7 @@ function testAddInline() { * Tests rendering an external JavaScript file. */ function testRenderExternal() { - drupal_add_library('core', 'drupal'); + drupal_add_library('core/drupal'); $external = 'http://example.com/example.js'; _drupal_add_js($external, 'external'); $javascript = drupal_get_js(); @@ -239,7 +239,7 @@ function testRenderExternal() { * Tests drupal_get_js() with a footer scope. */ function testFooterHTML() { - drupal_add_library('core', 'drupal'); + drupal_add_library('core/drupal'); $inline = 'jQuery(function () { });'; _drupal_add_js($inline, array('type' => 'inline', 'scope' => 'footer')); $javascript = drupal_get_js('footer'); @@ -250,7 +250,7 @@ function testFooterHTML() { * Tests _drupal_add_js() sets preproccess to FALSE when cache is also FALSE. */ function testNoCache() { - drupal_add_library('core', 'drupal'); + drupal_add_library('core/drupal'); $javascript = _drupal_add_js('core/misc/collapse.js', array('cache' => FALSE)); $this->assertFalse($javascript['core/misc/collapse.js']['preprocess'], 'Setting cache to FALSE sets proprocess to FALSE when adding JavaScript.'); } @@ -259,7 +259,7 @@ function testNoCache() { * Tests adding a JavaScript file with a different group. */ function testDifferentGroup() { - drupal_add_library('core', 'drupal'); + drupal_add_library('core/drupal'); $javascript = _drupal_add_js('core/misc/collapse.js', array('group' => JS_THEME)); $this->assertEqual($javascript['core/misc/collapse.js']['group'], JS_THEME, 'Adding a JavaScript file with a different group caches the given group.'); } @@ -280,7 +280,7 @@ function testDifferentWeight() { function testBrowserConditionalComments() { $default_query_string = $this->container->get('state')->get('system.css_js_query_string') ?: '0'; - drupal_add_library('core', 'drupal'); + drupal_add_library('core/drupal'); _drupal_add_js('core/misc/collapse.js', array('browsers' => array('IE' => 'lte IE 8', '!IE' => FALSE))); _drupal_add_js('jQuery(function () { });', array('type' => 'inline', 'browsers' => array('IE' => FALSE))); $javascript = drupal_get_js(); @@ -296,7 +296,7 @@ function testBrowserConditionalComments() { * Tests JavaScript versioning. */ function testVersionQueryString() { - drupal_add_library('core', 'drupal'); + drupal_add_library('core/drupal'); _drupal_add_js('core/misc/collapse.js', array('version' => 'foo')); _drupal_add_js('core/misc/ajax.js', array('version' => 'bar')); $javascript = drupal_get_js(); @@ -313,7 +313,7 @@ function testAggregation() { // ahead of ones without. The order of JavaScript execution must be the // same regardless of whether aggregation is enabled, so ensure this // expected order, first with aggregation off. - drupal_add_library('core', 'drupal'); + drupal_add_library('core/drupal'); _drupal_add_js('core/misc/ajax.js'); _drupal_add_js('core/misc/collapse.js', array('every_page' => TRUE)); _drupal_add_js('core/misc/autocomplete.js'); @@ -333,7 +333,7 @@ function testAggregation() { $config = \Drupal::config('system.performance'); $config->set('js.preprocess', 1); $config->save(); - drupal_add_library('core', 'drupal'); + drupal_add_library('core/drupal'); _drupal_add_js('core/misc/ajax.js'); _drupal_add_js('core/misc/collapse.js', array('every_page' => TRUE)); _drupal_add_js('core/misc/autocomplete.js'); @@ -356,7 +356,7 @@ function testAggregationOrder() { drupal_static_reset('_drupal_add_js'); // Add two JavaScript files to the current request and build the cache. - drupal_add_library('core', 'drupal'); + drupal_add_library('core/drupal'); _drupal_add_js('core/misc/ajax.js'); _drupal_add_js('core/misc/autocomplete.js'); @@ -377,7 +377,7 @@ function testAggregationOrder() { // Reset variables and add a file in a different scope first. \Drupal::state()->delete('system.js_cache_files'); drupal_static_reset('_drupal_add_js'); - drupal_add_library('core', 'drupal'); + drupal_add_library('core/drupal'); _drupal_add_js('some/custom/javascript_file.js', array('scope' => 'footer')); _drupal_add_js('core/misc/ajax.js'); _drupal_add_js('core/misc/autocomplete.js'); @@ -448,7 +448,7 @@ function testRenderDifferentWeight() { // JavaScript files are sorted first by group, then by the 'every_page' // flag, then by weight (see drupal_sort_css_js()), so to test the effect of // weight, we need the other two options to be the same. - drupal_add_library('core', 'jquery'); + drupal_add_library('core/jquery'); _drupal_add_js('core/misc/collapse.js', array('group' => JS_LIBRARY, 'every_page' => TRUE, 'weight' => -21)); $javascript = drupal_get_js(); $this->assertTrue(strpos($javascript, 'core/misc/collapse.js') < strpos($javascript, 'core/assets/vendor/jquery/jquery.js'), 'Rendering a JavaScript file above jQuery.'); @@ -475,7 +475,7 @@ function testAlter() { * Adds a library to the page and tests for both its JavaScript and its CSS. */ function testLibraryRender() { - $result = drupal_add_library('core', 'jquery.farbtastic'); + $result = drupal_add_library('core/jquery.farbtastic'); $this->assertTrue($result !== FALSE, 'Library was added without errors.'); $scripts = drupal_get_js(); $styles = drupal_get_css(); @@ -490,11 +490,11 @@ function testLibraryRender() { */ function testLibraryAlter() { // Verify that common_test altered the title of Farbtastic. - $library = drupal_get_library('core', 'jquery.farbtastic'); + $library = drupal_get_library('core/jquery.farbtastic'); $this->assertEqual($library['version'], '0.0', 'Registered libraries were altered.'); // common_test_library_info_alter() also added a dependency on jQuery Form. - drupal_add_library('core', 'jquery.farbtastic'); + drupal_add_library('core/jquery.farbtastic'); $scripts = drupal_get_js(); $this->assertTrue(strpos($scripts, 'core/assets/vendor/jquery-form/jquery.form.js'), 'Altered library dependencies are added to the page.'); } @@ -505,7 +505,7 @@ function testLibraryAlter() { * @see common_test.library.yml */ function testLibraryNameConflicts() { - $farbtastic = drupal_get_library('common_test', 'jquery.farbtastic'); + $farbtastic = drupal_get_library('common_test/jquery.farbtastic'); $this->assertEqual($farbtastic['version'], '0.1', 'Alternative libraries can be added to the page.'); } @@ -513,11 +513,11 @@ function testLibraryNameConflicts() { * Tests non-existing libraries. */ function testLibraryUnknown() { - $result = drupal_get_library('unknown', 'unknown'); + $result = drupal_get_library('unknown/unknown'); $this->assertFalse($result, 'Unknown library returned FALSE.'); drupal_static_reset('drupal_get_library'); - $result = drupal_add_library('unknown', 'unknown'); + $result = drupal_add_library('unknown/unknown'); $this->assertFalse($result, 'Unknown library returned FALSE.'); $scripts = drupal_get_js(); $this->assertTrue(strpos($scripts, 'unknown') === FALSE, 'Unknown library was not added to the page.'); @@ -527,7 +527,7 @@ function testLibraryUnknown() { * Tests the addition of libraries through the #attached['library'] property. */ function testAttachedLibrary() { - $element['#attached']['library'][] = array('core', 'jquery.farbtastic'); + $element['#attached']['library'][] = 'core/jquery.farbtastic'; drupal_render($element); $scripts = drupal_get_js(); $this->assertTrue(strpos($scripts, 'core/assets/vendor/farbtastic/farbtastic.js'), 'The attached_library property adds the additional libraries.'); @@ -546,10 +546,10 @@ function testGetLibrary() { $this->assertEqual($libraries, array(), 'Retrieving libraries from a module not declaring any libraries returns an emtpy array.'); // Retrieve a specific library by module and name. - $farbtastic = drupal_get_library('common_test', 'jquery.farbtastic'); + $farbtastic = drupal_get_library('common_test/jquery.farbtastic'); $this->assertEqual($farbtastic['version'], '0.1', 'Retrieved a single library.'); // Retrieve a non-existing library by module and name. - $farbtastic = drupal_get_library('common_test', 'foo'); + $farbtastic = drupal_get_library('common_test/foo'); $this->assertIdentical($farbtastic, FALSE, 'Retrieving a non-existing library returns FALSE.'); } diff --git a/core/modules/system/lib/Drupal/system/Tests/Common/MergeAttachmentsTest.php b/core/modules/system/lib/Drupal/system/Tests/Common/MergeAttachmentsTest.php index 3f806f37e37ab2642d200f4cb9c36bb6e648a50b..0aa9971e2a37860da87bf58b9a670942f964ea87 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Common/MergeAttachmentsTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Common/MergeAttachmentsTest.php @@ -28,20 +28,20 @@ public static function getInfo() { function testLibraryMerging() { $a['#attached'] = array( 'library' => array( - array('core', 'drupal'), - array('core', 'drupalSettings'), + 'core/drupal', + 'core/drupalSettings', ), ); $b['#attached'] = array( 'library' => array( - array('core', 'jquery'), + 'core/jquery', ), ); $expected['#attached'] = array( 'library' => array( - array('core', 'drupal'), - array('core', 'drupalSettings'), - array('core', 'jquery'), + 'core/drupal', + 'core/drupalSettings', + 'core/jquery', ), ); $this->assertIdentical($expected['#attached'], drupal_merge_attached($a['#attached'], $b['#attached']), 'Attachments merged correctly.'); @@ -49,22 +49,22 @@ function testLibraryMerging() { // Merging in the opposite direction yields the opposite library order. $expected['#attached'] = array( 'library' => array( - array('core', 'jquery'), - array('core', 'drupal'), - array('core', 'drupalSettings'), + 'core/jquery', + 'core/drupal', + 'core/drupalSettings', ), ); $this->assertIdentical($expected['#attached'], drupal_merge_attached($b['#attached'], $a['#attached']), 'Attachments merged correctly; opposite merging yields opposite order.'); // Merging with duplicates: duplicates are simply retained, it's up to the // rest of the system to handle duplicates. - $b['#attached']['library'][] = array('core', 'drupalSettings'); + $b['#attached']['library'][] = 'core/drupalSettings'; $expected['#attached'] = array( 'library' => array( - array('core', 'drupal'), - array('core', 'drupalSettings'), - array('core', 'jquery'), - array('core', 'drupalSettings'), + 'core/drupal', + 'core/drupalSettings', + 'core/jquery', + 'core/drupalSettings', ), ); $this->assertIdentical($expected['#attached'], drupal_merge_attached($a['#attached'], $b['#attached']), 'Attachments merged correctly; duplicates are retained.'); diff --git a/core/modules/system/lib/Drupal/system/Tests/Common/RenderElementTypesTest.php b/core/modules/system/lib/Drupal/system/Tests/Common/RenderElementTypesTest.php index 1d8db902a13fee1df8222553a12b2703f7509891..daf2e77a2da8c73214598b080630ee9c653a0591 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Common/RenderElementTypesTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Common/RenderElementTypesTest.php @@ -184,12 +184,11 @@ function testMaintenancePage() { // Build CSS links. drupal_static_reset('_drupal_add_css'); - $path = drupal_get_path('module', 'system'); $default_css = array( '#attached' => array( 'library' => array( - array('core', 'normalize'), - array('system', 'maintenance'), + 'core/normalize', + 'system/maintenance', ), ), ); diff --git a/core/modules/system/lib/Drupal/system/Tests/Common/RenderTest.php b/core/modules/system/lib/Drupal/system/Tests/Common/RenderTest.php index 6cfcb68ad59d7c8d7ead4626ca2838d3c3b75485..b2d7eb01b03a80f619dabdc1ef54c62f171b75e9 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Common/RenderTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Common/RenderTest.php @@ -608,8 +608,8 @@ function testDrupalRenderChildrenPostRenderCache() { array('type' => 'setting', 'data' => array('foo' => 'bar')) ), 'library' => array( - array('core', 'drupal.collapse'), - array('core', 'drupal.collapse'), + 'core/drupal.collapse', + 'core/drupal.collapse', ), ), '#post_render_cache' => array( @@ -691,8 +691,8 @@ function testDrupalRenderChildrenPostRenderCache() { array('type' => 'setting', 'data' => array('foo' => 'bar')) ), 'library' => array( - array('core', 'drupal.collapse'), - array('core', 'drupal.collapse'), + 'core/drupal.collapse', + 'core/drupal.collapse', ), ), '#post_render_cache' => array( @@ -718,7 +718,7 @@ function testDrupalRenderChildrenPostRenderCache() { $expected_child_element = array( '#attached' => array( 'library' => array( - array('core', 'drupal.collapse'), + 'core/drupal.collapse', ), ), '#post_render_cache' => array( diff --git a/core/modules/system/system.api.php b/core/modules/system/system.api.php index 5442b269aaf2f7edf351711055fdcc77b229a91e..3dcd6f85e327a7815985be673e661c9396b45466 100644 --- a/core/modules/system/system.api.php +++ b/core/modules/system/system.api.php @@ -362,12 +362,12 @@ function hook_library_info_alter(&$libraries, $module) { * * @see drupal_add_library() */ -function hook_library_alter(array &$library, $extension, $name) { - if ($extension == 'core' && $name == 'jquery.ui.datepicker') { +function hook_library_alter(array &$library, $name) { + if ($name == 'core/jquery.ui.datepicker') { // Note: If the added assets do not depend on additional request-specific // data supplied here, consider to statically register it directly via // hook_library_info_alter() already. - $library['dependencies'][] = array('locale', 'drupal.locale.datepicker'); + $library['dependencies'][] = 'locale/drupal.locale.datepicker'; $language_interface = \Drupal::languageManager()->getCurrentLanguage(); $settings['jquery']['ui']['datepicker'] = array( @@ -436,7 +436,7 @@ function hook_page_build(&$page) { $path = drupal_get_path('module', 'foo'); // Add JavaScript/CSS assets to all pages. // @see drupal_process_attached() - $page['#attached']['js'][$path . '/foo.css'] = array('every_page' => TRUE); + $page['#attached']['js'][$path . '/foo.js'] = array('every_page' => TRUE); $page['#attached']['css'][$path . '/foo.base.css'] = array('every_page' => TRUE); $page['#attached']['css'][$path . '/foo.theme.css'] = array('every_page' => TRUE); diff --git a/core/modules/system/system.module b/core/modules/system/system.module index edc8532d6f26c4c904908755477c4032dc0a33dd..360fc285a7203c2fc80a294a894e2517f9c19df2 100644 --- a/core/modules/system/system.module +++ b/core/modules/system/system.module @@ -1126,10 +1126,10 @@ function system_filetransfer_info() { */ function system_page_build(&$page) { // Ensure the same CSS is loaded in template_preprocess_maintenance_page(). - $page['#attached']['library'][] = array('core', 'normalize'); - $page['#attached']['library'][] = array('system', 'base'); + $page['#attached']['library'][] = 'core/normalize'; + $page['#attached']['library'][] = 'system/base'; if (path_is_admin(current_path())) { - $page['#attached']['library'][] = array('system', 'admin'); + $page['#attached']['library'][] = 'system/admin'; } // Handle setting the "active" class on links by: @@ -1140,7 +1140,7 @@ function system_page_build(&$page) { // @see template_preprocess_links() // @see \Drupal\system\Controller\SystemController::setLinkActiveClass if (\Drupal::currentUser()->isAuthenticated()) { - $page['#attached']['library'][] = array('core', 'drupal.active-link'); + $page['#attached']['library'][] = 'core/drupal.active-link'; } else { $page['#post_render_cache']['\Drupal\system\Controller\SystemController::setLinkActiveClass'] = array( @@ -1218,7 +1218,7 @@ function system_user_timezone(&$form, &$form_state) { if (!$account->getTimezone() && $account->id() == $user->id() && empty($form_state['input']['timezone'])) { $form['timezone']['#description'] = t('Your time zone setting will be automatically detected if possible. Confirm the selection and click save.'); $form['timezone']['timezone']['#attributes'] = array('class' => array('timezone-detect')); - drupal_add_library('core', 'drupal.timezone'); + drupal_add_library('core/drupal.timezone'); } } diff --git a/core/modules/system/tests/modules/common_test/common_test.module b/core/modules/system/tests/modules/common_test/common_test.module index c156c07f53208ea2800804647d71aa59d7c8137f..1a081df995e20c3b70056820b04f94e88d1d3605 100644 --- a/core/modules/system/tests/modules/common_test/common_test.module +++ b/core/modules/system/tests/modules/common_test/common_test.module @@ -145,7 +145,7 @@ function common_test_library_info_alter(&$libraries, $module) { // Change the version of Farbtastic to 0.0. $libraries['jquery.farbtastic']['version'] = '0.0'; // Make Farbtastic depend on jQuery Form to test library dependencies. - $libraries['jquery.farbtastic']['dependencies'][] = array('core', 'jquery.form'); + $libraries['jquery.farbtastic']['dependencies'][] = 'core/jquery.form'; } } diff --git a/core/modules/system/tests/modules/common_test/lib/Drupal/common_test/Controller/CommonTestController.php b/core/modules/system/tests/modules/common_test/lib/Drupal/common_test/Controller/CommonTestController.php index 294adcaf879c399f44cf255c0164ea33148feb80..32bc04f852177dc39a5846ddaa70f1cd7705a42f 100644 --- a/core/modules/system/tests/modules/common_test/lib/Drupal/common_test/Controller/CommonTestController.php +++ b/core/modules/system/tests/modules/common_test/lib/Drupal/common_test/Controller/CommonTestController.php @@ -67,7 +67,7 @@ public function jsAndCssQuerystring() { $attached = array( '#attached' => array( 'library' => array( - array('node', 'drupal.node'), + 'node/drupal.node', ), 'css' => array( drupal_get_path('module', 'node') . '/css/node.admin.css' => array(), diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Form/OverviewTerms.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Form/OverviewTerms.php index 8e5bcceca26621d853501e2d727e69fb625fd378..29868ab9b74cb4f06913874c2eaa96bb236e231a 100644 --- a/core/modules/taxonomy/lib/Drupal/taxonomy/Form/OverviewTerms.php +++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Form/OverviewTerms.php @@ -318,7 +318,7 @@ public function buildForm(array $form, array &$form_state, VocabularyInterface $ 'group' => 'term-depth', 'hidden' => FALSE, ); - $form['terms']['#attached']['library'][] = array('taxonomy', 'drupal.taxonomy'); + $form['terms']['#attached']['library'][] = 'taxonomy/drupal.taxonomy'; $form['terms']['#attached']['js'][] = array( 'data' => array('taxonomy' => array('backStep' => $back_step, 'forwardStep' => $forward_step)), 'type' => 'setting', diff --git a/core/modules/text/lib/Drupal/text/Plugin/Field/FieldWidget/TextareaWithSummaryWidget.php b/core/modules/text/lib/Drupal/text/Plugin/Field/FieldWidget/TextareaWithSummaryWidget.php index 2490ed2fcd5bb6d421aae20c4ee3ee07f7d61c47..4775b8667a4f504b17ebdc3ba8b658ad661e91ce 100644 --- a/core/modules/text/lib/Drupal/text/Plugin/Field/FieldWidget/TextareaWithSummaryWidget.php +++ b/core/modules/text/lib/Drupal/text/Plugin/Field/FieldWidget/TextareaWithSummaryWidget.php @@ -69,7 +69,7 @@ function formElement(FieldItemListInterface $items, $delta, array $element, arra '#rows' => $this->getSetting('summary_rows'), '#description' => t('Leave blank to use trimmed value of full text as the summary.'), '#attached' => array( - 'library' => array(array('text', 'drupal.text')), + 'library' => array('text/drupal.text'), ), '#attributes' => array('class' => array('text-summary')), '#prefix' => '<div class="text-summary-wrapper">', diff --git a/core/modules/toolbar/toolbar.module b/core/modules/toolbar/toolbar.module index 72179865d9cbdaecd4dde7817b8555fb45ccd8db..dc06282f8614fe3e2c1fec71d513a3269691bc3b 100644 --- a/core/modules/toolbar/toolbar.module +++ b/core/modules/toolbar/toolbar.module @@ -68,7 +68,7 @@ function toolbar_element_info() { '#theme' => 'toolbar', '#attached' => array( 'library' => array( - array('toolbar', 'toolbar'), + 'toolbar/toolbar', ), ), // Metadata for the toolbar wrapping element. @@ -346,7 +346,7 @@ function toolbar_toolbar() { ), '#attached' => array( 'library' => array( - array('toolbar', 'toolbar.escapeAdmin'), + 'toolbar/toolbar.escapeAdmin', ), ), '#weight' => -20, diff --git a/core/modules/tour/lib/Drupal/tour/TourViewBuilder.php b/core/modules/tour/lib/Drupal/tour/TourViewBuilder.php index 9d09cfdc49a06633efef2f716391faee001be753..4f3006e858f52a4278d6fac05b8c9750bb2eeca9 100644 --- a/core/modules/tour/lib/Drupal/tour/TourViewBuilder.php +++ b/core/modules/tour/lib/Drupal/tour/TourViewBuilder.php @@ -68,7 +68,7 @@ public function viewMultiple(array $entities = array(), $view_mode = 'full', $la } // If at least one tour was built, attach the tour library. if ($build) { - $build['#attached']['library'][] = array('tour', 'tour'); + $build['#attached']['library'][] = 'tour/tour'; } return $build; } diff --git a/core/modules/tour/tour.module b/core/modules/tour/tour.module index d23c6e23ace4f012099955d61f75838c4de6a54f..610c025c057a8f336037ec4090654a3a360f3eb9 100644 --- a/core/modules/tour/tour.module +++ b/core/modules/tour/tour.module @@ -65,7 +65,7 @@ function tour_toolbar() { ), '#attached' => array( 'library' => array( - array('tour', 'tour'), + 'tour/tour', ), ), ); diff --git a/core/modules/update/update.manager.inc b/core/modules/update/update.manager.inc index b0d04832a95fe04e136d49757771749992bda854..c93b63b13b9f3b893acf2ec0504f09c8830dd9c4 100644 --- a/core/modules/update/update.manager.inc +++ b/core/modules/update/update.manager.inc @@ -82,7 +82,7 @@ function update_manager_update_form($form, $form_state = array(), $context) { return $form; } - $form['#attached']['library'][] = array('update', 'drupal.update.admin'); + $form['#attached']['library'][] = 'update/drupal.update.admin'; // This will be a nested array. The first key is the kind of project, which // can be either 'enabled', 'disabled', 'manual' (projects which require diff --git a/core/modules/update/update.report.inc b/core/modules/update/update.report.inc index 51da7dd18158d7c1fb6a108f3863978d32bd4279..bb87e61bec689b511ec049fa82fcde8242db6fd2 100644 --- a/core/modules/update/update.report.inc +++ b/core/modules/update/update.report.inc @@ -297,7 +297,7 @@ function theme_update_report($variables) { $assets = array( '#attached' => array( 'library' => array( - array('update', 'drupal.update.admin'), + 'update/drupal.update.admin', ), ) ); diff --git a/core/modules/user/lib/Drupal/user/Form/UserPermissionsForm.php b/core/modules/user/lib/Drupal/user/Form/UserPermissionsForm.php index 82d3829572d655ab114eb51ff7932058d551ab56..a1586a65d3a32bae70ad750d5d363119ad66be47 100644 --- a/core/modules/user/lib/Drupal/user/Form/UserPermissionsForm.php +++ b/core/modules/user/lib/Drupal/user/Form/UserPermissionsForm.php @@ -174,7 +174,7 @@ public function buildForm(array $form, array &$form_state) { $form['actions'] = array('#type' => 'actions'); $form['actions']['submit'] = array('#type' => 'submit', '#value' => $this->t('Save permissions')); - $form['#attached']['library'][] = array('user', 'drupal.user.permissions'); + $form['#attached']['library'][] = 'user/drupal.user.permissions'; return $form; } diff --git a/core/modules/user/lib/Drupal/user/RegisterFormController.php b/core/modules/user/lib/Drupal/user/RegisterFormController.php index 32a79226376c81ee02ffb2355a7720bca95dff72..89c91a05dfeb22975493acd66ad831be65b1b607 100644 --- a/core/modules/user/lib/Drupal/user/RegisterFormController.php +++ b/core/modules/user/lib/Drupal/user/RegisterFormController.php @@ -44,7 +44,7 @@ public function form(array $form, array &$form_state) { return new RedirectResponse(url('user/' . \Drupal::currentUser()->id(), array('absolute' => TRUE))); } - $form['#attached']['library'][] = array('core', 'jquery.cookie'); + $form['#attached']['library'][] = 'core/jquery.cookie'; $form['#attributes']['class'][] = 'user-info-from-cookie'; // Start with the default user account fields. diff --git a/core/modules/user/user.module b/core/modules/user/user.module index cfdc66c85c645fdcb70ce203689d304da4a6549f..8c83ae591007250b8ee19af3595c95a9b3d0bf2f 100644 --- a/core/modules/user/user.module +++ b/core/modules/user/user.module @@ -1594,7 +1594,7 @@ function user_form_process_password_confirm($element) { 'password' => $password_settings, ); - $element['#attached']['library'][] = array('user', 'drupal.user'); + $element['#attached']['library'][] = 'user/drupal.user'; // Ensure settings are only added once per page. static $already_added = FALSE; if (!$already_added) { @@ -1734,7 +1734,7 @@ function user_toolbar() { '#weight' => 100, '#attached' => array( 'library' => array( - array('user', 'drupal.user.icons'), + 'user/drupal.user.icons', ), ), ); diff --git a/core/modules/views/lib/Drupal/views/ViewExecutable.php b/core/modules/views/lib/Drupal/views/ViewExecutable.php index 17131c4568b2c5e6986c1016323562cf5cb1236e..7d06d42d9c9e391170612c3003ee3e396915ac22 100644 --- a/core/modules/views/lib/Drupal/views/ViewExecutable.php +++ b/core/modules/views/lib/Drupal/views/ViewExecutable.php @@ -445,7 +445,7 @@ public function __construct(ViewStorageInterface $storage, AccountInterface $use $this->user = $user; // Add the default css for a view. - $this->element['#attached']['library'][] = array('views', 'views.module'); + $this->element['#attached']['library'][] = 'views/views.module'; } /** diff --git a/core/modules/views/views.module b/core/modules/views/views.module index 944c0c91bffc9f7050a3fa747ef2d14ee44e606f..5747ce32b453bc3a1cc96923985f8a2d2287ab08 100644 --- a/core/modules/views/views.module +++ b/core/modules/views/views.module @@ -332,7 +332,7 @@ function views_preprocess_page(&$variables) { unset($class[$key]); $attributes['class'] = $class; $attributes['data-views-page-contextual-id'] = $variables['title_suffix']['contextual_links']['#id']; - drupal_add_library('views', 'views.contextual-links'); + drupal_add_library('views/views.contextual-links'); } } } diff --git a/core/modules/views/views.theme.inc b/core/modules/views/views.theme.inc index 8cb4cd214f50df1b766cdbdc410d725613497022..1acadb72772d4396e357ae2f4528d307e845e8e4 100644 --- a/core/modules/views/views.theme.inc +++ b/core/modules/views/views.theme.inc @@ -127,7 +127,7 @@ function template_preprocess_views_view(&$variables) { ), ); $view->element['#attached']['js'][] = array('type' => 'setting', 'data' => $settings); - $view->element['#attached']['library'][] = array('views', 'views.ajax'); + $view->element['#attached']['library'][] = 'views/views.ajax'; } // If form fields were found in the view, reformat the view output as a form. @@ -732,7 +732,7 @@ function template_preprocess_views_view_table(&$variables) { } if (!empty($options['sticky'])) { - $variables['view']->element['#attached']['library'][] = array('core', 'drupal.tableheader'); + $variables['view']->element['#attached']['library'][] = 'core/drupal.tableheader'; $variables['attributes']['class'][] = "sticky-enabled"; } $variables['attributes']['class'][] = 'cols-' . count($variables['header']); @@ -755,7 +755,7 @@ function template_preprocess_views_view_table(&$variables) { // with the classes represented by the constants RESPONSIVE_PRIORITY_MEDIUM // and RESPONSIVE_PRIORITY_LOW, add the tableresponsive behaviors. if (isset($variables['header']) && $responsive) { - $variables['view']->element['#attached']['library'][] = array('core', 'drupal.tableresponsive'); + $variables['view']->element['#attached']['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. $variables['attributes']['class'][] = 'responsive-enabled'; @@ -1066,7 +1066,7 @@ function template_preprocess_views_exposed_form(&$variables) { } // Include basic theming for exposed forms. - $form['#attached']['library'][] = array('views', 'views.exposed-form'); + $form['#attached']['library'][] = 'views/views.exposed-form'; foreach ($form['#info'] as $info) { if (!empty($info['label'])) { diff --git a/core/modules/views_ui/lib/Drupal/views_ui/ViewEditFormController.php b/core/modules/views_ui/lib/Drupal/views_ui/ViewEditFormController.php index 0373116d63de9e24f84af5ab1d4301cef27d5381..c65f5d7ae31d69a43d3c01b28e29e21ed4a52a25 100644 --- a/core/modules/views_ui/lib/Drupal/views_ui/ViewEditFormController.php +++ b/core/modules/views_ui/lib/Drupal/views_ui/ViewEditFormController.php @@ -83,13 +83,13 @@ public function form(array $form, array &$form_state) { $form['#tree'] = TRUE; - $form['#attached']['library'][] = array('core', 'jquery.ui.tabs'); - $form['#attached']['library'][] = array('core', 'jquery.ui.dialog'); - $form['#attached']['library'][] = array('core', 'drupal.states'); - $form['#attached']['library'][] = array('core', 'drupal.tabledrag'); + $form['#attached']['library'][] = 'core/jquery.ui.tabs'; + $form['#attached']['library'][] = 'core/jquery.ui.dialog'; + $form['#attached']['library'][] = 'core/drupal.states'; + $form['#attached']['library'][] = 'core/drupal.tabledrag'; if (!\Drupal::config('views.settings')->get('no_javascript')) { - $form['#attached']['library'][] = array('views_ui', 'views_ui.admin'); + $form['#attached']['library'][] = 'views_ui/views_ui.admin'; } $form['#attached']['css'] = static::getAdminCSS(); diff --git a/core/modules/views_ui/lib/Drupal/views_ui/ViewListController.php b/core/modules/views_ui/lib/Drupal/views_ui/ViewListController.php index dc8d5e4c6a748f227357d558c32bb2d3d6d11734..ec643203c816b87dcd5dec157ea33f1fefd7c6e4 100644 --- a/core/modules/views_ui/lib/Drupal/views_ui/ViewListController.php +++ b/core/modules/views_ui/lib/Drupal/views_ui/ViewListController.php @@ -167,8 +167,8 @@ public function render() { $list['#attributes']['id'] = 'views-entity-list'; $list['#attached']['css'] = ViewFormControllerBase::getAdminCSS(); - $list['#attached']['library'][] = array('core', 'drupal.ajax'); - $list['#attached']['library'][] = array('views_ui', 'views_ui.listing'); + $list['#attached']['library'][] = 'core/drupal.ajax'; + $list['#attached']['library'][] = 'views_ui/views_ui.listing'; $form['filters'] = array( '#type' => 'container', diff --git a/core/modules/views_ui/views_ui.theme.inc b/core/modules/views_ui/views_ui.theme.inc index db4f3e85b79ca9c6f678b7d90728f709f14bce2b..87ca306bdee686d045bbe8a1121924382ce001fa 100644 --- a/core/modules/views_ui/views_ui.theme.inc +++ b/core/modules/views_ui/views_ui.theme.inc @@ -499,7 +499,7 @@ function template_preprocess_views_ui_view_preview_section(&$variables) { '#links' => $links, '#attributes' => array('class' => array('contextual-links')), '#attached' => array( - 'library' => array(array('contextual', 'drupal.contextual-links')), + 'library' => array('contextual/drupal.contextual-links'), ), ); $variables['links'] = $build; diff --git a/core/themes/bartik/bartik.theme b/core/themes/bartik/bartik.theme index 2535b24ce742e8024eeebbb4453d23554f076170..642674c76aabb8d994081f736773f1b13e1dd947 100644 --- a/core/themes/bartik/bartik.theme +++ b/core/themes/bartik/bartik.theme @@ -100,7 +100,7 @@ function bartik_preprocess_maintenance_page(&$variables) { $libraries = array( '#attached' => array( 'library' => array( - array('bartik', 'maintenance_page'), + 'bartik/maintenance_page', ), ), ); diff --git a/core/themes/seven/seven.theme b/core/themes/seven/seven.theme index 938af2ae89408846d9a2d051e6b8ec71a7e64c8a..6f5ce6b3f0c01933c714956ad96eeae092199257 100644 --- a/core/themes/seven/seven.theme +++ b/core/themes/seven/seven.theme @@ -47,7 +47,7 @@ function seven_menu_local_tasks(&$variables) { if (!empty($variables['primary'])) { $variables['primary']['#attached'] = array( 'library' => array( - array('seven', 'drupal.nav-tabs'), + 'seven/drupal.nav-tabs', ), ); $variables['primary']['#prefix'] = '<h2 id="primary-tabs-title" class="visually-hidden">' . t('Primary tabs') . '</h2>'; @@ -61,7 +61,7 @@ function seven_menu_local_tasks(&$variables) { if (!empty($variables['secondary'])) { $variables['secondary']['#attached'] = array( 'library' => array( - array('seven', 'drupal.nav-tabs'), + 'seven/drupal.nav-tabs', ), ); $variables['secondary']['#prefix'] = '<h2 id="secondary-tabs-title" class="visually-hidden">' . t('Secondary tabs') . '</h2>'; @@ -234,7 +234,7 @@ function seven_menu_local_action($variables) { $libraries = array( '#attached' => array( 'library' => array( - array('core', 'modernizr'), + 'core/modernizr', ), ), ); @@ -261,7 +261,7 @@ function seven_menu_local_action($variables) { function seven_element_info_alter(&$type) { // We require Modernizr for button styling. if (isset($type['button'])) { - $type['button']['#attached']['library'][] = array('core', 'modernizr'); + $type['button']['#attached']['library'][] = 'core/modernizr'; } } @@ -274,7 +274,7 @@ function seven_preprocess_install_page(&$variables) { // Normally we could attach libraries via hook_page_alter(), but when the // database is inactive it's not called so we add them here. - $libraries['#attached']['library'][] = array('seven', 'install-page'); + $libraries['#attached']['library'][] = 'seven/install-page'; drupal_render($libraries); }