Commit 07ad6e73 authored by webchick's avatar webchick

Issue #1737148 by nod_, SebCorbin, larowlan, tim.plunkett, Albert Volkman,...

Issue #1737148 by nod_, SebCorbin, larowlan, tim.plunkett, Albert Volkman, nick_schuch, sun: Explicitly declare all JS dependencies, don't use drupal_add_js().
parent fe247ca5
......@@ -2727,18 +2727,6 @@ function drupal_get_css($css = NULL, $skip_alter = FALSE) {
// Sort CSS items, so that they appear in the correct order.
uasort($css, 'drupal_sort_css_js');
// Provide the page with information about the individual CSS files used,
// information not otherwise available when CSS aggregation is enabled. The
// setting is attached later in this function, but is set here, so that CSS
// files removed below are still considered "used" and prevented from being
// added in a later AJAX request.
// Skip if no files were added to the page or jQuery.extend() will overwrite
// the Drupal.settings.ajaxPageState.css object with an empty array.
if (!empty($css)) {
// Cast the array to an object to be on the safe side even if not empty.
$setting['ajaxPageState']['css'] = (object) array_fill_keys(array_keys($css), 1);
}
// Remove the overridden CSS files. Later CSS files override former ones.
$previous_item = array();
foreach ($css as $key => $item) {
......@@ -3806,55 +3794,33 @@ function drupal_add_js($data = NULL, $options = NULL) {
// Tweak the weight so that files of the same weight are included in the
// order of the calls to drupal_add_js().
$options['weight'] += count($javascript) / 1000;
if (isset($data)) {
// Add jquery.js and drupal.js, as well as the basePath setting, the
// first time a JavaScript file is added.
if (empty($javascript)) {
// url() generates the script and prefix using hook_url_outbound_alter().
// Instead of running the hook_url_outbound_alter() again here, extract
// them from url().
// @todo Make this less hacky: http://drupal.org/node/1547376.
$scriptPath = $GLOBALS['script_path'];
$pathPrefix = '';
url('', array('script' => &$scriptPath, 'prefix' => &$pathPrefix));
$javascript = array(
'settings' => array(
'data' => array(
array('basePath' => base_path()),
array('scriptPath' => $scriptPath),
array('pathPrefix' => $pathPrefix),
array('currentPath' => current_path()),
),
'type' => 'setting',
'scope' => 'header',
'group' => JS_SETTING,
'every_page' => TRUE,
'weight' => 0,
'browsers' => array(),
),
'core/misc/drupal.js' => array(
'data' => 'core/misc/drupal.js',
'type' => 'file',
'scope' => 'header',
'group' => JS_LIBRARY,
'every_page' => TRUE,
'weight' => -1,
'preprocess' => TRUE,
'cache' => TRUE,
'defer' => FALSE,
'async' => FALSE,
'browsers' => array(),
),
);
// Register all required libraries.
drupal_add_library('system', 'jquery', TRUE);
drupal_add_library('system', 'jquery.once', TRUE);
drupal_add_library('system', 'html5shiv', TRUE);
}
switch ($options['type']) {
case 'setting':
// If the setting array doesn't exist, add defaults values.
if (!isset($javascript['settings'])) {
$javascript['settings'] = array(
'type' => 'setting',
'scope' => 'header',
'group' => JS_SETTING,
'every_page' => TRUE,
'weight' => 0,
'browsers' => array(),
);
// url() generates the script and prefix using hook_url_outbound_alter().
// Instead of running the hook_url_outbound_alter() again here, extract
// them from url().
// @todo Make this less hacky: http://drupal.org/node/1547376.
$scriptPath = $GLOBALS['script_path'];
$pathPrefix = '';
url('', array('script' => &$scriptPath, 'prefix' => &$pathPrefix));
$javascript['settings']['data'][] = array(
'basePath' => base_path(),
'scriptPath' => $scriptPath,
'pathPrefix' => $pathPrefix,
'currentPath' => current_path(),
);
}
// All JavaScript settings are placed in the header of the page with
// the library weight so that inline scripts appear afterwards.
$javascript['settings']['data'][] = $data;
......@@ -3953,23 +3919,59 @@ function drupal_get_js($scope = 'header', $javascript = NULL, $skip_alter = FALS
}
}
// Sort the JavaScript so that it appears in the correct order.
uasort($items, 'drupal_sort_css_js');
if (!empty($items)) {
// Sort the JavaScript files so that they appear in the correct order.
uasort($items, 'drupal_sort_css_js');
// Don't add settings if there is no other JavaScript on the page, unless
// this is an AJAX request.
// @todo Clean up container call.
$container = drupal_container();
if ($container->has('request') && $container->has('content_negotiation')) {
$type = $container->get('content_negotiation')->getContentType($container->get('request'));
}
if (!empty($items['settings']) || (!empty($type) && $type == 'ajax')) {
global $theme_key;
// Provide the page with information about the theme that's used, so that
// a later AJAX request can be rendered using the same theme.
// @see ajax_base_page_theme()
$setting['ajaxPageState']['theme'] = $theme_key;
// Checks that the DB is available before filling theme_token.
if (!defined('MAINTENANCE_MODE')) {
$setting['ajaxPageState']['theme_token'] = drupal_get_token($theme_key);
}
// Provide the page with information about the individual JavaScript files
// used, information not otherwise available when aggregation is enabled.
$setting['ajaxPageState']['js'] = array_fill_keys(array_keys($items), 1);
unset($setting['ajaxPageState']['js']['settings']);
// Provide the page with information about the individual CSS files used,
// information not otherwise available when CSS aggregation is enabled.
// The setting is attached later in this function, but is set here, so
// that CSS files removed in drupal_process_attached() are still
// considered "used" and prevented from being added in a later AJAX
// request.
// Skip if no files were added to the page otherwise jQuery.extend() will
// overwrite the Drupal.settings.ajaxPageState.css object with an empty
// array.
$css = drupal_add_css();
if (!empty($css)) {
// Cast the array to an object to be on the safe side even if not empty.
$setting['ajaxPageState']['css'] = (object) array_fill_keys(array_keys($css), 1);
}
// Provide the page with information about the individual JavaScript files
// used, information not otherwise available when aggregation is enabled.
$setting['ajaxPageState']['js'] = array_fill_keys(array_keys($items), 1);
unset($setting['ajaxPageState']['js']['settings']);
drupal_add_js($setting, 'setting');
drupal_add_js($setting, 'setting');
// If we're outputting the header scope, then this might be the final time
// that drupal_get_js() is running, so add the setting to this output as well
// as to the drupal_add_js() cache. If $items['settings'] doesn't exist, it's
// because drupal_get_js() was intentionally passed a $javascript argument
// stripped of settings, potentially in order to override how settings get
// output, so in this case, do not add the setting to this output.
if ($scope == 'header' && isset($items['settings'])) {
$items['settings']['data'][] = $setting;
// If we're outputting the header scope, then this might be the final time
// that drupal_get_js() is running, so add the settings to this output as well
// as to the drupal_add_js() cache. If $items['settings'] doesn't exist, it's
// because drupal_get_js() was intentionally passed a $javascript argument
// stripped of settings, potentially in order to override how settings get
// output, so in this case, do not add the setting to this output.
if ($scope == 'header' && isset($items['settings'])) {
$items['settings']['data'][] = $setting;
}
}
}
// Render the HTML needed to load the JavaScript.
......@@ -4235,7 +4237,7 @@ function drupal_aggregate_js(&$js_groups) {
* are the attached data. For example:
* @code
* $build['#attached'] = array(
* 'js' => array(drupal_get_path('module', 'taxonomy') . '/taxonomy.js'),
* 'library' => array(array('taxonomy', 'taxonomy')),
* 'css' => array(drupal_get_path('module', 'taxonomy') . '/taxonomy.css'),
* );
* @endcode
......
......@@ -3424,7 +3424,7 @@ function theme_tableselect($variables) {
// checkboxes/radios in the first table column.
if ($element['#js_select']) {
// Add a "Select all" checkbox.
drupal_add_js('core/misc/tableselect.js');
drupal_add_library('system', 'drupal.tableselect');
array_unshift($header, array('class' => array('select-all')));
}
else {
......@@ -3614,7 +3614,7 @@ function form_process_machine_name($element, &$form_state) {
),
),
);
$element['#attached']['js'][] = 'core/misc/machine-name.js';
$element['#attached']['library'][] = array('system', 'drupal.machine-name');
$element['#attached']['js'][] = $js_settings;
return $element;
......
......@@ -1531,9 +1531,9 @@ function install_configure_form($form, &$form_state, &$install_state) {
drupal_set_message(st('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');
}
drupal_add_js(drupal_get_path('module', 'system') . '/system.js');
drupal_add_library('system', 'drupal.system');
// Add JavaScript time zone detection.
drupal_add_js('core/misc/timezone.js');
drupal_add_library('system', 'drupal.timezone');
// We add these strings as settings because JavaScript translation does not
// work on install time.
drupal_add_js(array('copyFieldValue' => array('edit-site-mail' => array('edit-account-mail'))), 'setting');
......
......@@ -93,15 +93,6 @@ function drupal_theme_initialize() {
// Themes can have alter functions, so reset the drupal_alter() cache.
drupal_static_reset('drupal_alter');
// Provide the page with information about the theme that's used, so that a
// later Ajax request can be rendered using the same theme.
// @see ajax_base_page_theme()
$setting['ajaxPageState'] = array(
'theme' => $theme_key,
'theme_token' => drupal_get_token($theme_key),
);
drupal_add_js($setting, 'setting');
}
/**
......@@ -1841,7 +1832,7 @@ function theme_table($variables) {
// Add sticky headers, if applicable.
if (count($header) && $sticky) {
drupal_add_js('core/misc/tableheader.js');
drupal_add_library('system', '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';
......@@ -2603,6 +2594,7 @@ function template_process_page(&$variables) {
* @see html.tpl.php
*/
function template_process_html(&$variables) {
drupal_add_library('system', 'html5shiv', TRUE);
// Render page_top and page_bottom into top level variables.
$variables['page_top'] = drupal_render($variables['page']['page_top']);
$variables['page_bottom'] = drupal_render($variables['page']['page_bottom']);
......
......@@ -82,8 +82,8 @@ function block_admin_display_prepare_blocks($theme) {
function block_admin_display_form($form, &$form_state, $blocks, $theme, $block_regions = NULL) {
$path = drupal_get_path('module', 'block');
$form['#attached']['css'][] = $path . '/block.admin.css';
$form['#attached']['js'][] = 'core/misc/tableheader.js';
$form['#attached']['js'][] = $path . '/block.js';
$form['#attached']['library'][] = array('system', 'drupal.tableheader');
$form['#attached']['library'][] = array('block', 'drupal.block');
// Get a list of block regions if one was not provided.
if (!isset($block_regions)) {
......@@ -346,7 +346,7 @@ function block_admin_configure($form, &$form_state, $module, $delta) {
$form['visibility'] = array(
'#type' => 'vertical_tabs',
'#attached' => array(
'js' => array(drupal_get_path('module', 'block') . '/block.js'),
'library' => array(array('block', 'drupal.block')),
),
);
......
......@@ -1085,3 +1085,22 @@ function block_language_delete($language) {
->condition('langcode', $language->langcode)
->execute();
}
/**
* Implements hook_library_info().
*/
function block_library_info() {
$libraries['drupal.block'] = array(
'title' => 'Block',
'version' => VERSION,
'js' => array(
drupal_get_path('module', 'block') . '/block.js' => array(),
),
'dependencies' => array(
array('system', 'jquery'),
array('system', 'drupal'),
),
);
return $libraries;
}
......@@ -544,7 +544,7 @@ function _book_add_form_elements(&$form, &$form_state, Node $node) {
'class' => array('book-outline-form'),
),
'#attached' => array(
'js' => array(drupal_get_path('module', 'book') . '/book.js'),
'library' => array(array('book', 'drupal.book')),
),
'#tree' => TRUE,
);
......@@ -1454,3 +1454,23 @@ function book_menu_subtree_data($link) {
return $tree[$cid];
}
/**
* Implements hook_library_info().
*/
function book_library_info() {
$libraries['drupal.book'] = array(
'title' => 'Book',
'version' => VERSION,
'js' => array(
drupal_get_path('module', 'book') . '/book.js' => array(),
),
'dependencies' => array(
array('system', 'jquery'),
array('system', 'drupal'),
array('system', 'drupal.form'),
),
);
return $libraries;
}
......@@ -184,9 +184,8 @@ function color_scheme_form($complete_form, &$form_state, $theme) {
'#options' => $color_sets,
'#default_value' => $scheme_name,
'#attached' => array(
// Add Farbtastic color picker.
'library' => array(
array('system', 'farbtastic'),
array('color', 'drupal.color'),
),
// Add custom CSS.
'css' => array(
......@@ -194,7 +193,6 @@ function color_scheme_form($complete_form, &$form_state, $theme) {
),
// Add custom JavaScript.
'js' => array(
$base . '/color.js',
array(
'data' => array(
'color' => array(
......@@ -246,6 +244,7 @@ function theme_color_scheme_form($variables) {
$path = drupal_get_path('theme', $theme) . '/';
drupal_add_css($path . $info['preview_css']);
// @todo Transform to add library.
$preview_js_path = isset($info['preview_js']) ? $path . $info['preview_js'] : drupal_get_path('module', 'color') . '/' . 'preview.js';
// Add the JS at a weight below color.js.
drupal_add_js($preview_js_path, array('weight' => -1));
......@@ -744,3 +743,38 @@ function _color_rgb2hsl($rgb) {
return array($h, $s, $l);
}
/**
* Implements hook_library_info().
*/
function color_library_info() {
$libraries['drupal.color'] = array(
'title' => 'Color',
'version' => VERSION,
'js' => array(
drupal_get_path('module', 'color') . '/color.js' => array(),
),
'dependencies' => array(
array('system', 'jquery'),
array('system', 'drupal'),
array('system', 'jquery.once'),
array('system', 'jquery.farbtastic'),
array('color', 'drupal.color.preview'),
),
);
$libraries['drupal.color.preview'] = array(
'title' => 'Color preview',
'version' => VERSION,
'js' => array(
drupal_get_path('module', 'color') . '/preview.js' => array(),
),
'dependencies' => array(
array('system', 'jquery'),
array('system', 'drupal'),
array('system', 'drupal.settings'),
array('system', 'jquery.once'),
),
);
return $libraries;
}
......@@ -1188,7 +1188,7 @@ function comment_form_node_type_form_alter(&$form, $form_state) {
'class' => array('comment-node-type-settings-form'),
),
'#attached' => array(
'js' => array(drupal_get_path('module', 'comment') . '/comment-node-form.js'),
'library' => array('comment', 'drupal.comment'),
),
);
// Unlike coment_form_node_form_alter(), all of these settings are applied
......@@ -1266,8 +1266,8 @@ function comment_form_node_form_alter(&$form, $form_state) {
'class' => array('comment-node-settings-form'),
),
'#attached' => array(
'js' => array(drupal_get_path('module', 'comment') . '/comment-node-form.js'),
),
'library' => array('comment', 'drupal.comment'),
),
'#weight' => 30,
);
$comment_count = isset($node->nid) ? db_query('SELECT comment_count FROM {node_comment_statistics} WHERE nid = :nid', array(':nid' => $node->nid))->fetchField() : 0;
......@@ -2142,3 +2142,23 @@ function comment_file_download_access($field, EntityInterface $entity, File $fil
return FALSE;
}
}
/**
* Implements hook_library_info().
*/
function comment_library_info() {
$libraries['drupal.comment'] = array(
'title' => 'Comment',
'version' => VERSION,
'js' => array(
drupal_get_path('module', 'comment') . '/comment-node-form.js' => array(),
),
'dependencies' => array(
array('system', 'jquery'),
array('system', 'drupal'),
array('system', 'drupal.form'),
),
);
return $libraries;
}
......@@ -40,10 +40,10 @@ function contextual_permission() {
*/
function contextual_library_info() {
$path = drupal_get_path('module', 'contextual');
$libraries['contextual-links'] = array(
$libraries['drupal.contextual-links'] = array(
'title' => 'Contextual Links',
'website' => 'http://drupal.org/node/473268',
'version' => '1.0',
'version' => VERSION,
'js' => array(
$path . '/contextual.js' => array(),
),
......@@ -51,7 +51,13 @@ function contextual_library_info() {
$path . '/contextual.base.css' => array(),
$path . '/contextual.theme.css' => array(),
),
'dependencies' => array(
array('system', 'jquery'),
array('system', 'drupal'),
array('system', 'jquery.once'),
),
);
return $libraries;
}
......@@ -68,7 +74,7 @@ function contextual_element_info() {
'#attributes' => array('class' => array('contextual-links')),
'#attached' => array(
'library' => array(
array('contextual', 'contextual-links'),
array('contextual', 'drupal.contextual-links'),
),
),
);
......
......@@ -640,8 +640,7 @@ function field_ui_field_overview_form($form, &$form_state, $entity_type, $bundle
$form['actions'] = array('#type' => 'actions');
$form['actions']['submit'] = array('#type' => 'submit', '#value' => t('Save'));
$form['#attached']['css'][] = drupal_get_path('module', 'field_ui') . '/field_ui.admin.css';
$form['#attached']['js'][] = drupal_get_path('module', 'field_ui') . '/field_ui.js';
$form['#attached']['library'][] = array('field_ui', 'drupal.field_ui');
// Add settings for the update selects behavior.
$js_fields = array();
......@@ -1228,8 +1227,7 @@ function field_ui_display_overview_form($form, &$form_state, $entity_type, $bund
$form['actions'] = array('#type' => 'actions');
$form['actions']['submit'] = array('#type' => 'submit', '#value' => t('Save'));
$form['#attached']['js'][] = drupal_get_path('module', 'field_ui') . '/field_ui.js';
$form['#attached']['css'][] = drupal_get_path('module', 'field_ui') . '/field_ui.admin.css';
$form['#attached']['library'][] = array('field_ui', 'drupal.field_ui');
// Add tabledrag behavior.
$form['#attached']['drupal_add_tabledrag'][] = array('field-display-overview', 'order', 'sibling', 'field-weight');
......
......@@ -380,3 +380,27 @@ function field_ui_form_node_type_form_submit($form, &$form_state) {
$form_state['redirect'] = _field_ui_bundle_admin_path('node', $form_state['values']['type']) .'/fields';
}
}
/**
* Implements hook_library_info().
*/
function field_ui_library_info() {
$libraries['drupal.field_ui'] = array(
'title' => 'Field UI',
'version' => VERSION,
'js' => array(
drupal_get_path('module', 'field_ui') . '/field_ui.js' => array(),
),
'css' => array(
drupal_get_path('module', 'field_ui') . '/field_ui.admin.css' => array(),
),
'dependencies' => array(
array('system', 'jquery'),
array('system', 'drupal'),
array('system', 'drupal.settings'),
array('system', 'jquery.once'),
),
);
return $libraries;
}
......@@ -37,7 +37,7 @@ function file_field_settings_form($field, $instance, $has_data) {
$defaults = field_info_field_settings($field['type']);
$settings = array_merge($defaults, $field['settings']);
$form['#attached']['js'][] = drupal_get_path('module', 'file') . '/file.js';
$form['#attached']['library'][] = array('file', 'drupal.file');
$form['display_field'] = array(
'#type' => 'checkbox',
......
......@@ -78,8 +78,7 @@ function file_element_info() {
'#size' => 22,
'#extended' => FALSE,
'#attached' => array(
'css' => array($file_path . '/file.admin.css'),
'js' => array($file_path . '/file.js'),
'library' => array(array('file','drupal.file')),
),
);
return $types;
......@@ -1035,3 +1034,26 @@ function file_get_file_references(File $file, $field = NULL, $age = FIELD_LOAD_R
/**
* @} End of "defgroup file-module-api".
*/
/**
* Implements hook_library_info().
*/
function file_library_info() {
$libraries['drupal.file'] = array(
'title' => 'File',
'version' => VERSION,
'js' => array(
drupal_get_path('module', 'file') . '/file.js' => array(),
),
'css' => array(
drupal_get_path('module', 'file') . '/file.admin.css'
),
'dependencies' => array(
array('system', 'jquery'),
array('system', 'drupal'),
array('system', 'drupal.settings'),
),
);
return $libraries;
}
......@@ -155,8 +155,7 @@ function filter_admin_format_form($form, &$form_state, $format) {
$form['#format'] = $format;
$form['#tree'] = TRUE;
$form['#attached']['js'][] = drupal_get_path('module', 'filter') . '/filter.admin.js';
$form['#attached']['css'][] = drupal_get_path('module', 'filter') . '/filter.admin.css';
$form['#attached']['library'][] = array('filter', 'drupal.filter.admin');
$form['name'] = array(
'#type' => 'textfield',
......
......@@ -878,8 +878,7 @@ function filter_process_format($element) {
// Turn original element into a text format wrapper.
$path = drupal_get_path('module', 'filter');
$element['#attached']['js'][] = $path . '/filter.js';
$element['#attached']['css'][] = $path . '/filter.admin.css';
$element['#attached']['library'][] = array('filter', 'drupal.filter');
// Setup child container for the text format widget.
$element['format'] = array(
......@@ -1764,3 +1763,42 @@ function _filter_html_escape_tips($filter, $format, $long = FALSE) {
/**
* @} End of "defgroup standard_filters".
*/
/**
* Implements hook_library_info().
*/
function filter_library_info() {
$libraries['drupal.filter.admin'] = array(
'title' => 'Filter',
'version' => VERSION,
'js' => array(
drupal_get_path('module', 'filter') . '/filter.admin.js' => array(),
),
'css' => array(
drupal_get_path('module', 'filter') . '/filter.admin.css'
),
'dependencies' => array(
array('system', 'jquery'),
array('system', 'drupal'),
array('system', 'jquery.once'),
array('system', 'drupal.form'),
),
);
$libraries['drupal.filter'] = array(
'title' => 'Filter',
'version' => VERSION,
'js' => array(
drupal_get_path('module', 'filter') . '/filter.js' => array(),
),
'css' => array(
drupal_get_path('module', 'filter') . '/filter.admin.css'
),
'dependencies' => array(
array('system', 'jquery'),
array('system', 'drupal'),
array('system', 'jquery.once'),
),
);
return $libraries;
}
......@@ -114,6 +114,10 @@ function testExportTranslation() {
* Test exportation of translation template file.
*/
function testExportTranslationTemplateFile() {
// Load an admin page with JavaScript so drupal_add_library() fires at least
// once and _locale_parse_js_file() gets to run at least once so that the
// locales_source table gets populated with something.
$this->drupalGet('admin/config/regional/language');
// Get the translation template file.
$this->drupalPost('admin/config/regional/translate/export', array(), t('Export'));
// Ensure we have a translation file.
......
......@@ -374,7 +374,7 @@ function locale_js_alter(&$javascript) {
$files = $new_files = FALSE;
foreach ($javascript as $item) {
if ($item['type'] == 'file') {
if (isset($item['type']) && $item['type'] == 'file') {
$files = TRUE;
$filepath = $item['data'];
if (!in_array($filepath, $parsed)) {
......@@ -420,6 +420,38 @@ function locale_js_alter(&$javascript) {
}
}
/**
* Implements hook_library_info().
*/
function locale_library_info() {
$libraries['drupal.locale.admin'] = array(
'title' => 'Locale',
'version' => VERSION,
'js' => array(
drupal_get_path('module', 'locale') . '/locale.admin.js' => array(),
),
'dependencies' => array(
array('system', 'jquery'),
array('system', 'drupal'),
array('system', 'jquery.once'),
),
);
$libraries['drupal.locale.datepicker'] = array(
'title' => 'Locale Datepicker UI',
'version' => VERSION,
'js' => array(
drupal_get_path('module', 'locale') . '/locale.datepicker.js' => array(),
),
'dependencies' => array(
array('system', 'jquery'),
array('system', 'drupal'),
array('system', 'drupal.settings'),
),
);
return $libraries;
}
/**
* Implement hook_library_info_alter().
*
......@@ -431,8 +463,7 @@ function locale_library_info_alter(&$libraries, $module) {
// locale.datepicker.js should be added in the JS_LIBRARY group, so that
// this attach behavior will execute early. JS_LIBRARY is the default for
// hook_library_info_alter(), thus does not have to be specified explicitly.
$datepicker = drupal_get_path('module', 'locale') . '/locale.datepicker.js';
$libraries['jquery.ui.datepicker']['js'][$datepicker] = array();
$libraries['jquery.ui.datepicker']['dependencies'][] = array('locale', 'drupal.locale.datepicker');
$libraries['jquery.ui.datepicker']['js'][] = array(
'data' => array(
'jquery' => array(
......
......@@ -255,9 +255,7 @@ function locale_translate_edit_form($form, &$form_state) {
$form['#attached']['css'] = array(
$path . '/locale.admin.css',
);
$form['#attached']['js'] = array(
$path . '/locale.admin.js',
);
$form['#attached']['library'][] = array('locale', 'drupal.locale.admin');
$form['langcode'] = array(