diff options
Diffstat (limited to 'modules')
-rw-r--r-- | modules/book/book.module | 4 | ||||
-rw-r--r-- | modules/color/color.module | 34 | ||||
-rw-r--r-- | modules/comment/comment.module | 12 | ||||
-rw-r--r-- | modules/field/field.attach.inc | 4 | ||||
-rw-r--r-- | modules/file/file.field.inc | 8 | ||||
-rw-r--r-- | modules/file/file.module | 6 | ||||
-rw-r--r-- | modules/image/image.admin.inc | 12 | ||||
-rw-r--r-- | modules/menu/menu.admin.inc | 4 | ||||
-rw-r--r-- | modules/menu/menu.module | 4 | ||||
-rw-r--r-- | modules/node/content_types.inc | 4 | ||||
-rw-r--r-- | modules/node/node.pages.inc | 12 | ||||
-rw-r--r-- | modules/path/path.module | 4 | ||||
-rw-r--r-- | modules/simpletest/tests/common.test | 8 | ||||
-rw-r--r-- | modules/system/system.module | 6 | ||||
-rw-r--r-- | modules/taxonomy/taxonomy.admin.inc | 4 | ||||
-rw-r--r-- | modules/toolbar/toolbar.module | 14 | ||||
-rw-r--r-- | modules/tracker/tracker.pages.inc | 4 | ||||
-rw-r--r-- | modules/upload/upload.admin.inc | 4 | ||||
-rw-r--r-- | modules/upload/upload.module | 4 | ||||
-rw-r--r-- | modules/user/user.admin.inc | 2 |
20 files changed, 93 insertions, 61 deletions
diff --git a/modules/book/book.module b/modules/book/book.module index ca49a98c4..1ac28bce6 100644 --- a/modules/book/book.module +++ b/modules/book/book.module @@ -445,7 +445,9 @@ function _book_add_form_elements(&$form, $node) { '#collapsible' => TRUE, '#collapsed' => TRUE, '#group' => 'additional_settings', - '#attached_js' => array(drupal_get_path('module', 'book') . '/book.js'), + '#attached' => array( + 'js' => array(drupal_get_path('module', 'book') . '/book.js'), + ), '#tree' => TRUE, '#attributes' => array('class' => array('book-outline-form')), ); diff --git a/modules/color/color.module b/modules/color/color.module index a08114fa3..fe62dc02d 100644 --- a/modules/color/color.module +++ b/modules/color/color.module @@ -148,22 +148,24 @@ function color_scheme_form(&$form_state, $theme) { '#title' => t('Color set'), '#options' => $info['schemes'], '#default_value' => $current, - // Add Farbtastic color picker. - '#attached_library' => array( - array('system', 'farbtastic'), - ), - // Add custom CSS. - '#attached_css' => array( - $base . '/color.css' => array('preprocess' => FALSE), - ), - // Add custom JavaScript. - '#attached_js' => array( - $base . '/color.js', - array( - 'data' => array('color' => array( - 'reference' => color_get_palette($theme, TRUE), - )), - 'type' => 'setting', + '#attached' => array( + // Add Farbtastic color picker. + 'library' => array( + array('system', 'farbtastic'), + ), + // Add custom CSS. + 'css' => array( + $base . '/color.css' => array('preprocess' => FALSE), + ), + // Add custom JavaScript. + 'js' => array( + $base . '/color.js', + array( + 'data' => array( + 'color' => array('reference' => color_get_palette($theme, TRUE)), + ), + 'type' => 'setting', + ), ), ), ); diff --git a/modules/comment/comment.module b/modules/comment/comment.module index b17d3c71f..3decfdc84 100644 --- a/modules/comment/comment.module +++ b/modules/comment/comment.module @@ -590,7 +590,7 @@ function comment_node_page_additions($node) { $comments = comment_load_multiple($cids); comment_prepare_thread($comments); $build = comment_build_multiple($comments); - $build['#attached_css'][] = drupal_get_path('module', 'comment') . '/comment.css'; + $build['#attached']['css'][] = drupal_get_path('module', 'comment') . '/comment.css'; $build['pager']['#theme'] = 'pager'; $additions['comments'] = $build; } @@ -940,7 +940,9 @@ function comment_form_node_type_form_alter(&$form, $form_state) { '#collapsible' => TRUE, '#collapsed' => TRUE, '#group' => 'additional_settings', - '#attached_js' => array(drupal_get_path('module', 'comment') . '/comment-node-form.js'), + '#attached' => array( + 'js' => array(drupal_get_path('module', 'comment') . '/comment-node-form.js'), + ), ); $form['comment']['comment_default_mode'] = array( '#type' => 'checkbox', @@ -1006,7 +1008,9 @@ function comment_form_alter(&$form, $form_state, $form_id) { '#collapsible' => TRUE, '#collapsed' => TRUE, '#group' => 'additional_settings', - '#attached_js' => array(drupal_get_path('module', 'comment') . '/comment-node-form.js'), + '#attached' => array( + 'js' => array(drupal_get_path('module', 'comment') . '/comment-node-form.js'), + ), '#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; @@ -1614,7 +1618,7 @@ function comment_form(&$form_state, $comment) { $node = node_load($comment->nid); if (!$user->uid && variable_get('comment_anonymous_' . $node->type, COMMENT_ANONYMOUS_MAYNOT_CONTACT) != COMMENT_ANONYMOUS_MAYNOT_CONTACT) { - $form_state['#attached_js'][] = drupal_get_path('module', 'comment') . '/comment.js'; + $form_state['#attached']['js'][] = drupal_get_path('module', 'comment') . '/comment.js'; } $comment = (array) $comment; diff --git a/modules/field/field.attach.inc b/modules/field/field.attach.inc index 1cdd3b0c2..4cf57c483 100644 --- a/modules/field/field.attach.inc +++ b/modules/field/field.attach.inc @@ -490,7 +490,7 @@ function field_attach_form($obj_type, $object, &$form, &$form_state, $langcode = // Add custom weight handling. list($id, $vid, $bundle) = field_attach_extract_ids($obj_type, $object); - $form['#attached_css'][] = drupal_get_path('module', 'field') . '/theme/field.css'; + $form['#attached']['css'][] = drupal_get_path('module', 'field') . '/theme/field.css'; $form['#pre_render'][] = '_field_extra_weights_pre_render'; $form['#extra_fields'] = field_extra_fields($bundle); @@ -1090,7 +1090,7 @@ function field_attach_view($obj_type, $object, $build_mode = 'full', $langcode = // Add custom weight handling. list($id, $vid, $bundle) = field_attach_extract_ids($obj_type, $object); - $output['#attached_css'][] = drupal_get_path('module', 'field') . '/theme/field.css'; + $output['#attached']['css'][] = drupal_get_path('module', 'field') . '/theme/field.css'; $output['#pre_render'][] = '_field_extra_weights_pre_render'; $output['#extra_fields'] = field_extra_fields($bundle); diff --git a/modules/file/file.field.inc b/modules/file/file.field.inc index 48a924784..12c1b600e 100644 --- a/modules/file/file.field.inc +++ b/modules/file/file.field.inc @@ -71,9 +71,7 @@ function file_field_settings_form($field, $instance) { $defaults = field_info_field_settings($field['type']); $settings = array_merge($defaults, $field['settings']); - $form = array( - '#attached_js' => array(drupal_get_path('module', 'file') . '/file.js'), - ); + $form['#attached']['js'][] = drupal_get_path('module', 'file') . '/file.js'; $form['display_field'] = array( '#type' => 'checkbox', @@ -119,9 +117,7 @@ function file_field_settings_form($field, $instance) { function file_field_instance_settings_form($field, $instance) { $settings = $instance['settings']; - $form = array( - '#attached_js' => array(drupal_get_path('module', 'file') . '/file.js'), - ); + $form['#attached']['js'][] = drupal_get_path('module', 'file') . '/file.js'; $form['max_filesize'] = array( '#type' => 'textfield', diff --git a/modules/file/file.module b/modules/file/file.module index 21b147889..4af5bae07 100644 --- a/modules/file/file.module +++ b/modules/file/file.module @@ -50,8 +50,10 @@ function file_elements() { '#upload_validators' => array(), '#upload_location' => NULL, '#extended' => FALSE, - '#attached_css' => array($file_path . '/file.css'), - '#attached_js' => array($file_path . '/file.js'), + '#attached' => array( + 'css' => array($file_path . '/file.css'), + 'js' => array($file_path . '/file.js'), + ), ); return $elements; diff --git a/modules/image/image.admin.inc b/modules/image/image.admin.inc index 5f96f50e0..10faf677a 100644 --- a/modules/image/image.admin.inc +++ b/modules/image/image.admin.inc @@ -15,7 +15,9 @@ function image_style_list() { $styles = image_styles(); $page['image_style_list'] = array( '#markup' => theme('image_style_list', $styles), - '#attached_css' => array(drupal_get_path('module', 'image') . '/image.admin.css' => array('preprocess' => FALSE)), + '#attached' => array( + 'css' => array(drupal_get_path('module', 'image') . '/image.admin.css' => array('preprocess' => FALSE)), + ), ); return $page; @@ -40,7 +42,9 @@ function image_style_form(&$form_state, $style) { $form_state['image_style'] = $style; $form = array( '#tree' => TRUE, - '#attached_css' => array(drupal_get_path('module', 'image') . '/image.admin.css' => array('preprocess' => FALSE)), + '#attached' => array( + 'css' => array(drupal_get_path('module', 'image') . '/image.admin.css' => array('preprocess' => FALSE)), + ), ); // Allow the name of the style to be changed. @@ -313,7 +317,9 @@ function image_effect_form(&$form_state, $style, $effect) { $form = array( '#tree' => TRUE, - '#attached_css' => array(drupal_get_path('module', 'image') . '/image.admin.css' => array('preprocess' => FALSE)), + '#attached' => array( + 'css' => array(drupal_get_path('module', 'image') . '/image.admin.css' => array('preprocess' => FALSE)), + ), ); if (function_exists($effect['form callback'])) { $form['data'] = call_user_func($effect['form callback'], $effect['data']); diff --git a/modules/menu/menu.admin.inc b/modules/menu/menu.admin.inc index f116a166b..48818e791 100644 --- a/modules/menu/menu.admin.inc +++ b/modules/menu/menu.admin.inc @@ -448,7 +448,9 @@ function menu_edit_menu(&$form_state, $type, $menu = array()) { '#maxsize' => MENU_MAX_MENU_NAME_LENGTH_UI, '#description' => t('This text will be used to construct the URL for the menu. The name must contain only lowercase letters, numbers and hyphens, and must be unique.'), '#required' => TRUE, - '#attached_js' => array(drupal_get_path('module', 'system') . '/system.js', $js_settings), + '#attached' => array( + 'js' => array(drupal_get_path('module', 'system') . '/system.js', $js_settings), + ), ); } diff --git a/modules/menu/menu.module b/modules/menu/menu.module index b27217b33..cef743390 100644 --- a/modules/menu/menu.module +++ b/modules/menu/menu.module @@ -412,7 +412,9 @@ function menu_form_alter(&$form, $form_state, $form_id) { '#collapsible' => TRUE, '#collapsed' => FALSE, '#group' => 'additional_settings', - '#attached_js' => array(drupal_get_path('module', 'menu') . '/menu.js'), + '#attached' => array( + 'js' => array(drupal_get_path('module', 'menu') . '/menu.js'), + ), '#tree' => TRUE, '#weight' => -2, '#attributes' => array('class' => array('menu-item-form')), diff --git a/modules/node/content_types.inc b/modules/node/content_types.inc index c6e9d6da2..223609041 100644 --- a/modules/node/content_types.inc +++ b/modules/node/content_types.inc @@ -101,7 +101,9 @@ function node_type_form(&$form_state, $type = NULL) { '#maxlength' => 32, '#required' => TRUE, '#description' => t('The machine-readable name of this content type. This text will be used for constructing the URL of the <em>add new content</em> page for this content type. This name must contain only lowercase letters, numbers, and underscores. Underscores will be converted into hyphens when constructing the URL of the <em>add new content</em> page. This name must be unique.'), - '#attached_js' => array(drupal_get_path('module', 'system') . '/system.js', $js_settings), + '#attached' => array( + 'js' => array(drupal_get_path('module', 'system') . '/system.js', $js_settings), + ), ); } else { diff --git a/modules/node/node.pages.inc b/modules/node/node.pages.inc index af5f2ffd5..60168012b 100644 --- a/modules/node/node.pages.inc +++ b/modules/node/node.pages.inc @@ -172,7 +172,9 @@ function node_form(&$form_state, $node) { // Collapsed by default when "Create new revision" is unchecked '#collapsed' => !$node->revision, '#group' => 'additional_settings', - '#attached_js' => array(drupal_get_path('module', 'node') . '/node.js'), + '#attached' => array( + 'js' => array(drupal_get_path('module', 'node') . '/node.js'), + ), '#weight' => 20, ); $form['revision_information']['revision'] = array( @@ -198,7 +200,9 @@ function node_form(&$form_state, $node) { '#collapsible' => TRUE, '#collapsed' => TRUE, '#group' => 'additional_settings', - '#attached_js' => array(drupal_get_path('module', 'node') . '/node.js'), + '#attached' => array( + 'js' => array(drupal_get_path('module', 'node') . '/node.js'), + ), '#weight' => 90, ); $form['author']['name'] = array( @@ -229,7 +233,9 @@ function node_form(&$form_state, $node) { '#collapsible' => TRUE, '#collapsed' => TRUE, '#group' => 'additional_settings', - '#attached_js' => array(drupal_get_path('module', 'node') . '/node.js'), + '#attached' => array( + 'js' => array(drupal_get_path('module', 'node') . '/node.js'), + ), '#weight' => 95, ); $form['options']['status'] = array( diff --git a/modules/path/path.module b/modules/path/path.module index 0d811b230..81ae6f49c 100644 --- a/modules/path/path.module +++ b/modules/path/path.module @@ -234,7 +234,9 @@ function path_form_alter(&$form, $form_state, $form_id) { '#collapsible' => TRUE, '#collapsed' => empty($path), '#group' => 'additional_settings', - '#attached_js' => array(drupal_get_path('module', 'path') . '/path.js'), + '#attached' => array( + 'js' => array(drupal_get_path('module', 'path') . '/path.js'), + ), '#access' => user_access('create url aliases'), '#weight' => 30, ); diff --git a/modules/simpletest/tests/common.test b/modules/simpletest/tests/common.test index dc6b0c7c8..d58a0ec1a 100644 --- a/modules/simpletest/tests/common.test +++ b/modules/simpletest/tests/common.test @@ -896,14 +896,10 @@ class JavaScriptTestCase extends DrupalWebTestCase { } /** - * Tests the addition of libraries through the #attached_library property. + * Tests the addition of libraries through the #attached['library'] property. */ function testAttachedLibrary() { - $element = array( - '#attached_library' => array( - array('system', 'farbtastic'), - ) - ); + $element['#attached']['library'][] = array('system', 'farbtastic'); drupal_render($element); $scripts = drupal_get_js(); $this->assertTrue(strpos($scripts, 'misc/farbtastic/farbtastic.js'), t('The attached_library property adds the additional libraries.')); diff --git a/modules/system/system.module b/modules/system/system.module index 70026bcdd..4c395d9d6 100644 --- a/modules/system/system.module +++ b/modules/system/system.module @@ -3101,8 +3101,10 @@ function system_page_build(&$page) { if (system_run_cron_image_access()) { $page['page_bottom']['run_cron'] = array( // Trigger cron run via AJAX. - '#attached_js' => array( - '(function($){ $.get(' . drupal_to_js(url('system/run-cron-image')) . '); })(jQuery);' => array('type' => 'inline', 'scope' => 'header'), + '#attached' => array( + 'js' => array( + '(function($){ $.get(' . drupal_to_js(url('system/run-cron-image')) . '); })(jQuery);' => array('type' => 'inline', 'scope' => 'header'), + ), ), // Trigger cron run for clients not supporting JavaScript (fall-back). '#markup' => theme('system_run_cron_image', 'system/run-cron-image'), diff --git a/modules/taxonomy/taxonomy.admin.inc b/modules/taxonomy/taxonomy.admin.inc index a95409e3c..ab011aa64 100644 --- a/modules/taxonomy/taxonomy.admin.inc +++ b/modules/taxonomy/taxonomy.admin.inc @@ -151,7 +151,9 @@ function taxonomy_form_vocabulary(&$form_state, $edit = array()) { '#maxlength' => 255, '#description' => t('The unique machine readable name for this vocabulary, used for theme templates, can only contain lowercase letters, numbers and underscores.'), '#required' => TRUE, - '#attached_js' => array(drupal_get_path('module', 'system') . '/system.js', $js_settings), + '#attached' => array( + 'js' => array(drupal_get_path('module', 'system') . '/system.js', $js_settings), + ), ); $form['help'] = array( '#type' => 'textfield', diff --git a/modules/toolbar/toolbar.module b/modules/toolbar/toolbar.module index b17107c4c..cbebf75b6 100644 --- a/modules/toolbar/toolbar.module +++ b/modules/toolbar/toolbar.module @@ -61,12 +61,14 @@ function toolbar_build() { $module_path = drupal_get_path('module', 'toolbar'); $build = array( '#theme' => 'toolbar', - '#attached_js' => array( - $module_path . '/toolbar.js', - array('data' => 'misc/jquery.cookie.js', 'weight' => JS_LIBRARY + 2), - ), - '#attached_css' => array( - $module_path . '/toolbar.css', + '#attached'=> array( + 'js' => array( + $module_path . '/toolbar.js', + array('data' => 'misc/jquery.cookie.js', 'weight' => JS_LIBRARY + 2), + ), + 'css' => array( + $module_path . '/toolbar.css', + ), ), ); diff --git a/modules/tracker/tracker.pages.inc b/modules/tracker/tracker.pages.inc index b39b415a7..1466848e5 100644 --- a/modules/tracker/tracker.pages.inc +++ b/modules/tracker/tracker.pages.inc @@ -76,7 +76,9 @@ function tracker_page($account = NULL, $set_title = FALSE) { '#rows' => $rows, '#header' => array(t('Type'), t('Post'), t('Author'), t('Replies'), t('Last updated')), '#theme' => 'table', - '#attached_css' => array(drupal_get_path('module', 'tracker') . '/tracker.css' => array('preprocess' => FALSE)), + '#attached' => array( + 'css' => array(drupal_get_path('module', 'tracker') . '/tracker.css' => array('preprocess' => FALSE)), + ), ); $page['pager'] = array( '#theme' => 'pager', diff --git a/modules/upload/upload.admin.inc b/modules/upload/upload.admin.inc index 7d9d14716..759cde460 100644 --- a/modules/upload/upload.admin.inc +++ b/modules/upload/upload.admin.inc @@ -69,8 +69,8 @@ function upload_admin_settings() { '#type' => 'fieldset', '#title' => t('General settings'), '#collapsible' => TRUE, - '#attached_css' => array( - drupal_get_path('module', 'upload') . '/upload.admin.css', + '#attached'=> array( + 'css' => array(drupal_get_path('module', 'upload') . '/upload.admin.css'), ), ); $form['settings_general']['upload_max_resolution'] = array( diff --git a/modules/upload/upload.module b/modules/upload/upload.module index 26a284439..76bc7b2b6 100644 --- a/modules/upload/upload.module +++ b/modules/upload/upload.module @@ -231,7 +231,9 @@ function upload_form_alter(&$form, $form_state, $form_id) { '#collapsible' => TRUE, '#collapsed' => empty($node->files), '#group' => 'additional_settings', - '#attached_js' => array(drupal_get_path('module', 'upload') . '/upload.js'), + '#attached' => array( + 'js' => array(drupal_get_path('module', 'upload') . '/upload.js'), + ), '#description' => t('Changes made to the attachments are not permanent until you save this post. The first "listed" file will be included in RSS feeds.'), '#weight' => 30, ); diff --git a/modules/user/user.admin.inc b/modules/user/user.admin.inc index 99948a357..d68da2410 100644 --- a/modules/user/user.admin.inc +++ b/modules/user/user.admin.inc @@ -651,7 +651,7 @@ function user_admin_permissions($form_state, $rid = NULL) { } $form['submit'] = array('#type' => 'submit', '#value' => t('Save permissions')); - $form['#attached_js'] = array(drupal_get_path('module', 'user') . '/user.permissions.js'); + $form['#attached']['js'][] = drupal_get_path('module', 'user') . '/user.permissions.js'; return $form; } |