diff --git a/core/includes/menu.inc b/core/includes/menu.inc index 6492b10..de98776 100644 --- a/core/includes/menu.inc +++ b/core/includes/menu.inc @@ -1623,6 +1623,9 @@ function theme_menu_link(array $variables) { */ function theme_menu_local_task($variables) { $link = $variables['element']['#link']; + $link += array( + 'localized_options' => array(), + ); $link_text = $link['title']; if (!empty($variables['element']['#active'])) { @@ -1868,8 +1871,8 @@ function menu_local_tasks($level = 0) { $data = &drupal_static(__FUNCTION__); $root_path = &drupal_static(__FUNCTION__ . ':root_path', ''); $empty = array( - 'tabs' => array('count' => 0, 'output' => array()), - 'actions' => array('count' => 0, 'output' => array()), + 'tabs' => array(), + 'actions' => array(), 'root_path' => &$root_path, ); @@ -1921,8 +1924,7 @@ function menu_local_tasks($level = 0) { // Tab parenting may skip levels, so the number of parts in the path may not // equal the depth. Thus we use the $depth counter (offset by 1000 for ksort). $depth = 1001; - $actions['count'] = 0; - $actions['output'] = array(); + $actions = array(); while (isset($children[$path])) { $tabs_current = array(); $actions_current = array(); @@ -1959,6 +1961,7 @@ function menu_local_tasks($level = 0) { '#theme' => 'menu_local_task', '#link' => $link, '#active' => TRUE, + '#weight' => isset($link['weight']) ? $link['weight'] : NULL, ); $next_path = $item['path']; $tab_count++; @@ -1971,6 +1974,7 @@ function menu_local_tasks($level = 0) { $actions_current[] = array( '#theme' => 'menu_local_action', '#link' => $link, + '#weight' => isset($link['weight']) ? $link['weight'] : NULL, ); $action_count++; } @@ -1979,6 +1983,7 @@ function menu_local_tasks($level = 0) { $tabs_current[] = array( '#theme' => 'menu_local_task', '#link' => $link, + '#weight' => isset($link['weight']) ? $link['weight'] : NULL, ); $tab_count++; } @@ -1986,10 +1991,8 @@ function menu_local_tasks($level = 0) { } } $path = $next_path; - $tabs[$depth]['count'] = $tab_count; - $tabs[$depth]['output'] = $tabs_current; - $actions['count'] += $action_count; - $actions['output'] = array_merge($actions['output'], $actions_current); + $tabs[$depth] = $tabs_current; + $actions = array_merge($actions, $actions_current); $depth++; } $data['actions'] = $actions; @@ -2035,6 +2038,7 @@ function menu_local_tasks($level = 0) { '#theme' => 'menu_local_task', '#link' => $link, '#active' => TRUE, + '#weight' => isset($link['weight']) ? $link['weight'] : NULL, ); $next_path = $item['tab_parent']; if (isset($tasks[$next_path])) { @@ -2045,14 +2049,14 @@ function menu_local_tasks($level = 0) { $tabs_current[] = array( '#theme' => 'menu_local_task', '#link' => $link, + '#weight' => isset($link['weight']) ? $link['weight'] : NULL, ); } } } $path = $next_path; $parent = $next_parent; - $tabs[$depth]['count'] = $count; - $tabs[$depth]['output'] = $tabs_current; + $tabs[$depth] = $tabs_current; $depth--; } // Sort by depth. @@ -2061,7 +2065,12 @@ function menu_local_tasks($level = 0) { $tabs = array_values($tabs); $data['tabs'] = $tabs; - // Allow modules to alter local tasks or dynamically append further tasks. + // Allow modules to dynamically add further tasks. + foreach (module_implements('menu_local_tasks') as $module) { + $function = $module . '_menu_local_tasks'; + $function($data, $router_item, $root_path); + } + // Allow modules to alter local tasks. drupal_alter('menu_local_tasks', $data, $router_item, $root_path); } @@ -2072,9 +2081,7 @@ function menu_local_tasks($level = 0) { 'root_path' => $root_path, ); } - // @todo If there are no tabs, then there still can be actions; for example, - // when added via hook_menu_local_tasks_alter(). - elseif (!empty($data['actions']['output'])) { + elseif (!empty($data['actions'])) { return array('actions' => $data['actions']) + $empty; } return $empty; @@ -2187,7 +2194,7 @@ function menu_contextual_links($module, $parent_path, $args) { function menu_primary_local_tasks() { $links = menu_local_tasks(0); // Do not display single tabs. - return ($links['tabs']['count'] > 1 ? $links['tabs']['output'] : ''); + return count($links['tabs']) > 1 ? $links['tabs'] : ''; } /** @@ -2196,7 +2203,7 @@ function menu_primary_local_tasks() { function menu_secondary_local_tasks() { $links = menu_local_tasks(1); // Do not display single tabs. - return ($links['tabs']['count'] > 1 ? $links['tabs']['output'] : ''); + return count($links['tabs']) > 1 ? $links['tabs'] : ''; } /** @@ -2204,7 +2211,7 @@ function menu_secondary_local_tasks() { */ function menu_local_actions() { $links = menu_local_tasks(); - return $links['actions']['output']; + return $links['actions']; } /** @@ -3567,7 +3574,6 @@ function _menu_router_build($callbacks) { $item['to_arg_functions'] = empty($to_arg_functions) ? '' : serialize($to_arg_functions); $item += array( 'title' => '', - 'weight' => 0, 'type' => MENU_NORMAL_ITEM, 'module' => '', '_number_parts' => $number_parts, @@ -3575,6 +3581,9 @@ function _menu_router_build($callbacks) { '_fit' => $fit, ); $item += array( + // Default MENU_DEFAULT_LOCAL_TASKs to a weight of -10, so they appear as + // first tab by default. + 'weight' => ($item['type'] & MENU_DEFAULT_LOCAL_TASK) == MENU_DEFAULT_LOCAL_TASK ? -10 : 0, '_visible' => (bool) ($item['type'] & MENU_VISIBLE_IN_BREADCRUMB), '_tab' => (bool) ($item['type'] & MENU_IS_LOCAL_TASK), ); diff --git a/core/modules/action/action.module b/core/modules/action/action.module index 6ebf1fb..6396caf 100644 --- a/core/modules/action/action.module +++ b/core/modules/action/action.module @@ -69,7 +69,6 @@ function action_menu() { 'description' => 'Manage the actions defined for your site.', 'page callback' => 'action_admin_manage', 'type' => MENU_DEFAULT_LOCAL_TASK, - 'weight' => -2, 'file' => 'action.admin.inc', ); $items['admin/config/system/actions/configure'] = array( diff --git a/core/modules/aggregator/aggregator.module b/core/modules/aggregator/aggregator.module index 047026a..0eac1ad 100644 --- a/core/modules/aggregator/aggregator.module +++ b/core/modules/aggregator/aggregator.module @@ -146,7 +146,6 @@ function aggregator_menu() { $items['admin/config/services/aggregator/list'] = array( 'title' => 'List', 'type' => MENU_DEFAULT_LOCAL_TASK, - 'weight' => -10, ); $items['admin/config/services/aggregator/settings'] = array( 'title' => 'Settings', @@ -155,6 +154,7 @@ function aggregator_menu() { 'page arguments' => array('aggregator_admin_form'), 'access arguments' => array('administer news feeds'), 'type' => MENU_LOCAL_TASK, + 'weight' => 100, 'file' => 'aggregator.admin.inc', ); $items['aggregator'] = array( @@ -201,7 +201,6 @@ function aggregator_menu() { $items['aggregator/categories/%aggregator_category/view'] = array( 'title' => 'View', 'type' => MENU_DEFAULT_LOCAL_TASK, - 'weight' => -10, ); $items['aggregator/categories/%aggregator_category/categorize'] = array( 'title' => 'Categorize', @@ -217,7 +216,7 @@ function aggregator_menu() { 'page arguments' => array('aggregator_form_category', 2), 'access arguments' => array('administer news feeds'), 'type' => MENU_LOCAL_TASK, - 'weight' => 1, + 'weight' => 10, 'file' => 'aggregator.admin.inc', ); $items['aggregator/sources/%aggregator_feed'] = array( @@ -229,7 +228,6 @@ function aggregator_menu() { $items['aggregator/sources/%aggregator_feed/view'] = array( 'title' => 'View', 'type' => MENU_DEFAULT_LOCAL_TASK, - 'weight' => -10, ); $items['aggregator/sources/%aggregator_feed/categorize'] = array( 'title' => 'Categorize', @@ -245,7 +243,7 @@ function aggregator_menu() { 'page arguments' => array('aggregator_form_feed', 2), 'access arguments' => array('administer news feeds'), 'type' => MENU_LOCAL_TASK, - 'weight' => 1, + 'weight' => 10, 'file' => 'aggregator.admin.inc', ); $items['admin/config/services/aggregator/edit/feed/%aggregator_feed'] = array( diff --git a/core/modules/block/block.module b/core/modules/block/block.module index 26bcb25..2beac1a 100644 --- a/core/modules/block/block.module +++ b/core/modules/block/block.module @@ -146,7 +146,6 @@ function block_menu() { 'title' => check_plain($theme->info['name']), 'page arguments' => array($key), 'type' => $key == $default_theme ? MENU_DEFAULT_LOCAL_TASK : MENU_LOCAL_TASK, - 'weight' => $key == $default_theme ? -10 : 0, 'access callback' => '_block_themes_access', 'access arguments' => array($key), 'file' => 'block.admin.inc', diff --git a/core/modules/book/book.module b/core/modules/book/book.module index f606e48..ddef7a2 100644 --- a/core/modules/book/book.module +++ b/core/modules/book/book.module @@ -146,7 +146,7 @@ function book_menu() { 'page arguments' => array('book_admin_settings'), 'access arguments' => array('administer site configuration'), 'type' => MENU_LOCAL_TASK, - 'weight' => 8, + 'weight' => 100, 'file' => 'book.admin.inc', ); $items['admin/content/book/%node'] = array( diff --git a/core/modules/comment/comment.module b/core/modules/comment/comment.module index ab757a9..1d0a5f6 100644 --- a/core/modules/comment/comment.module +++ b/core/modules/comment/comment.module @@ -221,7 +221,6 @@ function comment_menu() { $items['admin/content/comment/new'] = array( 'title' => 'Published comments', 'type' => MENU_DEFAULT_LOCAL_TASK, - 'weight' => -10, ); $items['admin/content/comment/approval'] = array( 'title' => 'Unapproved comments', @@ -239,7 +238,6 @@ function comment_menu() { $items['comment/%/view'] = array( 'title' => 'View comment', 'type' => MENU_DEFAULT_LOCAL_TASK, - 'weight' => -10, ); // Every other comment path uses %, but this one loads the comment directly, // so we don't end up loading it twice (in the page and access callback). @@ -250,7 +248,6 @@ function comment_menu() { 'access callback' => 'comment_access', 'access arguments' => array('edit', 1), 'type' => MENU_LOCAL_TASK, - 'weight' => 0, ); $items['comment/%/approve'] = array( 'title' => 'Approve', @@ -258,7 +255,7 @@ function comment_menu() { 'page arguments' => array(1), 'access arguments' => array('administer comments'), 'file' => 'comment.pages.inc', - 'weight' => 1, + 'weight' => 10, ); $items['comment/%/delete'] = array( 'title' => 'Delete', @@ -267,7 +264,7 @@ function comment_menu() { 'access arguments' => array('administer comments'), 'type' => MENU_LOCAL_TASK, 'file' => 'comment.admin.inc', - 'weight' => 2, + 'weight' => 20, ); $items['comment/reply/%node'] = array( 'title' => 'Add new comment', diff --git a/core/modules/config/config.module b/core/modules/config/config.module index a41fc09..f8a1874 100644 --- a/core/modules/config/config.module +++ b/core/modules/config/config.module @@ -51,7 +51,6 @@ function config_menu() { $items['admin/config/development/sync/import'] = array( 'title' => 'Import', 'type' => MENU_DEFAULT_LOCAL_TASK, - 'weight' => -10, ); return $items; } diff --git a/core/modules/config/tests/config_test/config_test.module b/core/modules/config/tests/config_test/config_test.module index 96d4aa0..a3e426c 100644 --- a/core/modules/config/tests/config_test/config_test.module +++ b/core/modules/config/tests/config_test/config_test.module @@ -107,7 +107,6 @@ function config_test_menu() { $items['admin/structure/config_test/manage/%config_test/edit'] = array( 'title' => 'Edit', 'type' => MENU_DEFAULT_LOCAL_TASK, - 'weight' => -10, ); $items['admin/structure/config_test/manage/%config_test/delete'] = array( 'title' => 'Delete', diff --git a/core/modules/contact/contact.module b/core/modules/contact/contact.module index 053df01..aaf18ed 100644 --- a/core/modules/contact/contact.module +++ b/core/modules/contact/contact.module @@ -82,7 +82,6 @@ function contact_menu() { $items['admin/structure/contact/manage/%contact_category/edit'] = array( 'title' => 'Edit', 'type' => MENU_DEFAULT_LOCAL_TASK, - 'weight' => -10, ); $items['admin/structure/contact/manage/%contact_category/delete'] = array( 'title' => 'Delete', diff --git a/core/modules/field_ui/field_ui.module b/core/modules/field_ui/field_ui.module index a04c0dd..30f69fb 100644 --- a/core/modules/field_ui/field_ui.module +++ b/core/modules/field_ui/field_ui.module @@ -67,6 +67,10 @@ function field_ui_menu() { 'type' => MENU_NORMAL_ITEM, 'file' => 'field_ui.admin.inc', ); + $items['admin/reports/fields/list'] = array( + 'title' => 'Entities', + 'type' => MENU_DEFAULT_LOCAL_TASK, + ); // Create tabs for all possible bundles. foreach (entity_get_info() as $entity_type => $entity_info) { @@ -181,9 +185,11 @@ function field_ui_menu() { 'access callback' => '_field_ui_view_mode_menu_access', 'access arguments' => array_merge(array($entity_type, $bundle_arg, $view_mode, $access['access callback']), $access['access arguments']), 'type' => ($view_mode == 'default' ? MENU_DEFAULT_LOCAL_TASK : MENU_LOCAL_TASK), - 'weight' => ($view_mode == 'default' ? -10 : $weight++), 'file' => 'field_ui.admin.inc', ); + if ($view_mode != 'default') { + $items["$path/display/$view_mode"]['weight'] = $weight++; + } } } } diff --git a/core/modules/filter/filter.module b/core/modules/filter/filter.module index 1aff070..9890796 100644 --- a/core/modules/filter/filter.module +++ b/core/modules/filter/filter.module @@ -151,7 +151,6 @@ function filter_menu() { 'page callback' => 'filter_admin_format_page', 'access arguments' => array('administer filters'), 'type' => MENU_LOCAL_ACTION, - 'weight' => 1, 'file' => 'filter.admin.inc', ); $items['admin/config/content/formats/%filter_format'] = array( diff --git a/core/modules/forum/forum.module b/core/modules/forum/forum.module index 9ec3ec6..3631f16 100644 --- a/core/modules/forum/forum.module +++ b/core/modules/forum/forum.module @@ -114,7 +114,6 @@ function forum_menu() { $items['admin/structure/forum/list'] = array( 'title' => 'List', 'type' => MENU_DEFAULT_LOCAL_TASK, - 'weight' => -10, ); $items['admin/structure/forum/add/container'] = array( 'title' => 'Add container', @@ -139,7 +138,7 @@ function forum_menu() { 'page callback' => 'drupal_get_form', 'page arguments' => array('forum_admin_settings'), 'access arguments' => array('administer forums'), - 'weight' => 5, + 'weight' => 100, 'type' => MENU_LOCAL_TASK, 'parent' => 'admin/structure/forum', 'file' => 'forum.admin.inc', @@ -162,9 +161,9 @@ function forum_menu() { } /** - * Implements hook_menu_local_tasks_alter(). + * Implements hook_menu_local_tasks(). */ -function forum_menu_local_tasks_alter(&$data, $router_item, $root_path) { +function forum_menu_local_tasks(&$data, $router_item, $root_path) { global $user; // Add action link to 'node/add/forum' on 'forum' sub-pages. @@ -209,7 +208,7 @@ function forum_menu_local_tasks_alter(&$data, $router_item, $root_path) { ); } } - $data['actions']['output'] = array_merge($data['actions']['output'], $links); + $data['actions'] += $links; } } } diff --git a/core/modules/image/image.module b/core/modules/image/image.module index 221e07c..cf97843 100644 --- a/core/modules/image/image.module +++ b/core/modules/image/image.module @@ -112,7 +112,6 @@ function image_menu() { 'page callback' => 'image_style_list', 'access arguments' => array('administer image styles'), 'type' => MENU_DEFAULT_LOCAL_TASK, - 'weight' => 1, 'file' => 'image.admin.inc', ); $items['admin/config/media/image-styles/add'] = array( diff --git a/core/modules/language/language.module b/core/modules/language/language.module index 987553d..57a5606 100644 --- a/core/modules/language/language.module +++ b/core/modules/language/language.module @@ -71,7 +71,6 @@ function language_menu() { ); $items['admin/config/regional/language/list'] = array( 'title' => 'List', - 'weight' => 0, 'type' => MENU_DEFAULT_LOCAL_TASK, ); $items['admin/config/regional/language/add'] = array( @@ -79,7 +78,6 @@ function language_menu() { 'page callback' => 'drupal_get_form', 'page arguments' => array('language_admin_add_form'), 'access arguments' => array('administer languages'), - 'weight' => 5, 'type' => MENU_LOCAL_ACTION, 'file' => 'language.admin.inc', ); diff --git a/core/modules/locale/locale.module b/core/modules/locale/locale.module index dac0557..7aeb26e 100644 --- a/core/modules/locale/locale.module +++ b/core/modules/locale/locale.module @@ -193,7 +193,6 @@ function locale_menu() { ); $items['admin/config/regional/translate/translate'] = array( 'title' => 'Translate', - 'weight' => -10, 'type' => MENU_DEFAULT_LOCAL_TASK, ); $items['admin/config/regional/translate/import'] = array( @@ -219,7 +218,7 @@ function locale_menu() { 'page callback' => 'drupal_get_form', 'page arguments' => array('locale_translate_settings'), 'access arguments' => array('translate interface'), - 'weight' => 40, + 'weight' => 100, 'type' => MENU_LOCAL_TASK, 'file' => 'locale.pages.inc', ); diff --git a/core/modules/menu/menu.module b/core/modules/menu/menu.module index e9080fd..c83a5e6 100644 --- a/core/modules/menu/menu.module +++ b/core/modules/menu/menu.module @@ -78,7 +78,6 @@ function menu_menu() { $items['admin/structure/menu/list'] = array( 'title' => 'List menus', 'type' => MENU_DEFAULT_LOCAL_TASK, - 'weight' => -10, ); $items['admin/structure/menu/add'] = array( 'title' => 'Add menu', @@ -94,7 +93,7 @@ function menu_menu() { 'page arguments' => array('menu_configure'), 'access arguments' => array('administer menu'), 'type' => MENU_LOCAL_TASK, - 'weight' => 5, + 'weight' => 100, 'file' => 'menu.admin.inc', ); $items['admin/structure/menu/manage/%menu'] = array( @@ -108,7 +107,6 @@ function menu_menu() { ); $items['admin/structure/menu/manage/%menu/list'] = array( 'title' => 'List links', - 'weight' => -10, 'type' => MENU_DEFAULT_LOCAL_TASK, 'context' => MENU_CONTEXT_PAGE | MENU_CONTEXT_INLINE, ); diff --git a/core/modules/node/node.module b/core/modules/node/node.module index a37679c..5ebc54c 100644 --- a/core/modules/node/node.module +++ b/core/modules/node/node.module @@ -1629,7 +1629,6 @@ function node_menu() { $items['admin/content/node'] = array( 'title' => 'Content', 'type' => MENU_DEFAULT_LOCAL_TASK, - 'weight' => -10, ); $items['admin/reports/status/rebuild'] = array( @@ -1653,7 +1652,6 @@ function node_menu() { $items['admin/structure/types/list'] = array( 'title' => 'List', 'type' => MENU_DEFAULT_LOCAL_TASK, - 'weight' => -10, ); $items['admin/structure/types/add'] = array( 'title' => 'Add content type', @@ -1728,7 +1726,6 @@ function node_menu() { $items['node/%node/view'] = array( 'title' => 'View', 'type' => MENU_DEFAULT_LOCAL_TASK, - 'weight' => -10, ); $items['node/%node/edit'] = array( 'title' => 'Edit', @@ -1736,7 +1733,6 @@ function node_menu() { 'page arguments' => array(1), 'access callback' => 'node_access', 'access arguments' => array('update', 1), - 'weight' => 0, 'type' => MENU_LOCAL_TASK, 'context' => MENU_CONTEXT_PAGE | MENU_CONTEXT_INLINE, 'file' => 'node.pages.inc', @@ -1747,7 +1743,7 @@ function node_menu() { 'page arguments' => array('node_delete_confirm', 1), 'access callback' => 'node_access', 'access arguments' => array('delete', 1), - 'weight' => 1, + 'weight' => 10, 'type' => MENU_LOCAL_TASK, 'context' => MENU_CONTEXT_INLINE, 'file' => 'node.pages.inc', @@ -1758,7 +1754,7 @@ function node_menu() { 'page arguments' => array(1), 'access callback' => '_node_revision_access', 'access arguments' => array(1), - 'weight' => 2, + 'weight' => 20, 'type' => MENU_LOCAL_TASK, 'file' => 'node.pages.inc', ); @@ -1768,6 +1764,7 @@ function node_menu() { 'page arguments' => array(3, TRUE), 'access callback' => '_node_revision_access', 'access arguments' => array(3), + 'type' => MENU_DEFAULT_LOCAL_TASK, ); $items['node/%node/revisions/%node_revision/revert'] = array( 'title' => 'Revert to earlier revision', @@ -1789,14 +1786,14 @@ function node_menu() { } /** - * Implements hook_menu_local_tasks_alter(). + * Implements hook_menu_local_tasks(). */ -function node_menu_local_tasks_alter(&$data, $router_item, $root_path) { +function node_menu_local_tasks(&$data, $router_item, $root_path) { // Add action link to 'node/add' on 'admin/content' page. if ($root_path == 'admin/content') { $item = menu_get_item('node/add'); if ($item['access']) { - $data['actions']['output'][] = array( + $data['actions'][] = array( '#theme' => 'menu_local_action', '#link' => $item, ); diff --git a/core/modules/path/path.module b/core/modules/path/path.module index 63e5c6c..3a468a0 100644 --- a/core/modules/path/path.module +++ b/core/modules/path/path.module @@ -64,6 +64,10 @@ function path_menu() { 'weight' => -5, 'file' => 'path.admin.inc', ); + $items['admin/config/search/path/list'] = array( + 'title' => 'List', + 'type' => MENU_DEFAULT_LOCAL_TASK, + ); $items['admin/config/search/path/edit/%path'] = array( 'title' => 'Edit alias', 'page callback' => 'path_admin_edit', @@ -78,11 +82,6 @@ function path_menu() { 'access arguments' => array('administer url aliases'), 'file' => 'path.admin.inc', ); - $items['admin/config/search/path/list'] = array( - 'title' => 'List', - 'type' => MENU_DEFAULT_LOCAL_TASK, - 'weight' => -10, - ); $items['admin/config/search/path/add'] = array( 'title' => 'Add alias', 'page callback' => 'path_admin_edit', diff --git a/core/modules/simpletest/simpletest.module b/core/modules/simpletest/simpletest.module index d7adb65..760947f 100644 --- a/core/modules/simpletest/simpletest.module +++ b/core/modules/simpletest/simpletest.module @@ -50,6 +50,7 @@ function simpletest_menu() { 'page arguments' => array('simpletest_settings_form'), 'access arguments' => array('administer unit tests'), 'type' => MENU_LOCAL_TASK, + 'weight' => 100, 'file' => 'simpletest.pages.inc', ); $items['admin/config/development/testing/results/%'] = array( diff --git a/core/modules/system/system.api.php b/core/modules/system/system.api.php index eb4de0d..2fe7c0c 100644 --- a/core/modules/system/system.api.php +++ b/core/modules/system/system.api.php @@ -1026,8 +1026,7 @@ function hook_menu_link_delete($link) { * Alter tabs and actions displayed on the page before they are rendered. * * This hook is invoked by menu_local_tasks(). The system-determined tabs and - * actions are passed in by reference. Additional tabs or actions may be added, - * or existing items altered. + * actions are passed in by reference. Additional tabs or actions may be added. * * Each tab or action is an associative array containing: * - #theme: The theme function to use to render. @@ -1035,30 +1034,24 @@ function hook_menu_link_delete($link) { * - title: The localized title of the link. * - href: The system path to link to. * - localized_options: An array of options to pass to l(). + * - #weight: The link's weight compared to other links. * - #active: Whether the link should be marked as 'active'. * - * @param $data + * @param array $data * An associative array containing: - * - actions: An associative array containing: - * - count: The amount of actions determined by the menu system, which can - * be ignored. - * - output: A list of of actions, each one being an associative array - * as described above. - * - tabs: An indexed array (list) of tab levels (up to 2 levels), each - * containing an associative array: - * - count: The amount of tabs determined by the menu system. This value - * does not need to be altered if there is more than one tab. - * - output: A list of of tabs, each one being an associative array as - * described above. - * @param $router_item + * - actions: A list of of actions, each one being an associative array + * as described above. + * - tabs: A list of (up to 2) tab levels that contain a list of of tabs, each + * one being an associative array as described above. + * @param array $router_item * The menu system router item of the page. - * @param $root_path + * @param string $root_path * The path to the root item for this set of tabs. */ -function hook_menu_local_tasks_alter(&$data, $router_item, $root_path) { +function hook_menu_local_tasks(&$data, $router_item, $root_path) { // Add an action linking to node/add to all pages. - $data['actions']['output'][] = array( - '#theme' => 'menu_local_task', + $data['actions'][] = array( + '#theme' => 'menu_local_action', '#link' => array( 'title' => t('Add new content'), 'href' => 'node/add', @@ -1071,7 +1064,7 @@ function hook_menu_local_tasks_alter(&$data, $router_item, $root_path) { ); // Add a tab linking to node/add to all pages. - $data['tabs'][0]['output'][] = array( + $data['tabs'][0][] = array( '#theme' => 'menu_local_task', '#link' => array( 'title' => t('Example tab'), @@ -1090,6 +1083,25 @@ function hook_menu_local_tasks_alter(&$data, $router_item, $root_path) { } /** + * Alter tabs and actions displayed on the page before they are rendered. + * + * This hook is invoked by menu_local_tasks(). The system-determined tabs and + * actions are passed in by reference. Existing tabs or actions may be altered. + * + * @param array $data + * An associative array containing tabs and actions. See + * hook_menu_local_tasks() for details. + * @param array $router_item + * The menu system router item of the page. + * @param string $root_path + * The path to the root item for this set of tabs. + * + * @see hook_menu_local_tasks() + */ +function hook_menu_local_tasks_alter(&$data, $router_item, $root_path) { +} + +/** * Alter links in the active trail before it is rendered as the breadcrumb. * * This hook is invoked by menu_get_active_breadcrumb() and allows alteration diff --git a/core/modules/system/system.module b/core/modules/system/system.module index 139fb0f..b5bfd28 100644 --- a/core/modules/system/system.module +++ b/core/modules/system/system.module @@ -641,7 +641,6 @@ function system_menu() { 'title' => 'List', 'description' => 'Select and configure your theme', 'type' => MENU_DEFAULT_LOCAL_TASK, - 'weight' => -1, 'file' => 'system.admin.inc', ); $items['admin/appearance/enable'] = array( @@ -673,13 +672,12 @@ function system_menu() { 'access arguments' => array('administer themes'), 'type' => MENU_LOCAL_TASK, 'file' => 'system.admin.inc', - 'weight' => 20, + 'weight' => 100, ); // Theme configuration subtabs. $items['admin/appearance/settings/global'] = array( 'title' => 'Global settings', 'type' => MENU_DEFAULT_LOCAL_TASK, - 'weight' => -1, ); foreach (list_themes() as $key => $theme) { diff --git a/core/modules/system/tests/modules/design_test/design_test.module b/core/modules/system/tests/modules/design_test/design_test.module index b8a1a80..9771ba4 100644 --- a/core/modules/system/tests/modules/design_test/design_test.module +++ b/core/modules/system/tests/modules/design_test/design_test.module @@ -75,7 +75,6 @@ function design_test_menu() { $items['design_test/list'] = array( 'title' => 'List', 'type' => MENU_DEFAULT_LOCAL_TASK, - 'weight' => -10, ); // Lastly, add the category containers. foreach ($categories as $category) { diff --git a/core/modules/system/tests/modules/menu_test/menu_test.module b/core/modules/system/tests/modules/menu_test/menu_test.module index 36cef57..b0bcdc5 100644 --- a/core/modules/system/tests/modules/menu_test/menu_test.module +++ b/core/modules/system/tests/modules/menu_test/menu_test.module @@ -124,7 +124,6 @@ function menu_test_menu() { $items['menu-test/hidden/menu/list'] = array( 'title' => 'List menus', 'type' => MENU_DEFAULT_LOCAL_TASK, - 'weight' => -10, ); $items['menu-test/hidden/menu/add'] = array( 'title' => 'Add menu', @@ -146,7 +145,6 @@ function menu_test_menu() { ); $items['menu-test/hidden/menu/manage/%menu/list'] = array( 'title' => 'List links', - 'weight' => -10, 'type' => MENU_DEFAULT_LOCAL_TASK, 'context' => MENU_CONTEXT_PAGE | MENU_CONTEXT_INLINE, ); @@ -178,7 +176,6 @@ function menu_test_menu() { $items['menu-test/hidden/block/list'] = array( 'title' => 'List', 'type' => MENU_DEFAULT_LOCAL_TASK, - 'weight' => -10, ); $items['menu-test/hidden/block/add'] = array( 'title' => 'Add block', diff --git a/core/modules/taxonomy/taxonomy.module b/core/modules/taxonomy/taxonomy.module index 3a1d297..4754260 100644 --- a/core/modules/taxonomy/taxonomy.module +++ b/core/modules/taxonomy/taxonomy.module @@ -252,7 +252,6 @@ function taxonomy_menu() { $items['admin/structure/taxonomy/list'] = array( 'title' => 'List', 'type' => MENU_DEFAULT_LOCAL_TASK, - 'weight' => -10, ); $items['admin/structure/taxonomy/add'] = array( 'title' => 'Add vocabulary', @@ -294,7 +293,7 @@ function taxonomy_menu() { 'access callback' => 'taxonomy_term_access', 'access arguments' => array('delete', 2), 'type' => MENU_LOCAL_TASK, - 'weight' => 11, + 'weight' => 20, 'file' => 'taxonomy.admin.inc', ); $items['taxonomy/term/%taxonomy_term/feed'] = array( @@ -327,7 +326,6 @@ function taxonomy_menu() { $items['admin/structure/taxonomy/%taxonomy_vocabulary_machine_name/list'] = array( 'title' => 'List', 'type' => MENU_DEFAULT_LOCAL_TASK, - 'weight' => -20, ); $items['admin/structure/taxonomy/%taxonomy_vocabulary_machine_name/edit'] = array( 'title' => 'Edit', @@ -335,7 +333,6 @@ function taxonomy_menu() { 'page arguments' => array(3), 'access arguments' => array('administer taxonomy'), 'type' => MENU_LOCAL_TASK, - 'weight' => -10, 'file' => 'taxonomy.admin.inc', ); diff --git a/core/modules/user/user.module b/core/modules/user/user.module index 285b9a7..545e6ad 100644 --- a/core/modules/user/user.module +++ b/core/modules/user/user.module @@ -1048,7 +1048,6 @@ function user_menu() { $items['user/login/default'] = array( 'title' => 'Username and password', 'type' => MENU_DEFAULT_LOCAL_TASK, - 'weight' => -10, ); $items['user/register'] = array( @@ -1105,7 +1104,6 @@ function user_menu() { 'description' => 'Find and manage people interacting with your site.', 'access arguments' => array('administer users'), 'type' => MENU_DEFAULT_LOCAL_TASK, - 'weight' => -10, 'file' => 'user.admin.inc', ); @@ -1172,7 +1170,6 @@ function user_menu() { $items['admin/config/people/accounts/settings'] = array( 'title' => 'Settings', 'type' => MENU_DEFAULT_LOCAL_TASK, - 'weight' => -10, ); $items['user/%user'] = array( @@ -1184,13 +1181,10 @@ function user_menu() { 'access callback' => 'user_view_access', 'access arguments' => array(1), ); - $items['user/%user/view'] = array( 'title' => 'View', 'type' => MENU_DEFAULT_LOCAL_TASK, - 'weight' => -10, ); - $items['user/%user/cancel'] = array( 'title' => 'Cancel account', 'page callback' => 'drupal_get_form', @@ -1199,7 +1193,6 @@ function user_menu() { 'access arguments' => array(1), 'file' => 'user.pages.inc', ); - $items['user/%user/cancel/confirm/%/%'] = array( 'title' => 'Confirm account cancellation', 'page callback' => 'user_cancel_confirm', @@ -1208,7 +1201,6 @@ function user_menu() { 'access arguments' => array(1), 'file' => 'user.pages.inc', ); - $items['user/%user/edit'] = array( 'title' => 'Edit', 'page callback' => 'entity_get_form', diff --git a/core/modules/views/views_ui/views_ui.module b/core/modules/views/views_ui/views_ui.module index 74c9e07..249f749 100644 --- a/core/modules/views/views_ui/views_ui.module +++ b/core/modules/views/views_ui/views_ui.module @@ -46,7 +46,6 @@ function views_ui_menu() { $items['admin/structure/views/list'] = array( 'title' => 'List', - 'weight' => -10, 'type' => MENU_DEFAULT_LOCAL_TASK, ) + $base; @@ -103,7 +102,6 @@ function views_ui_menu() { 'title' => 'Edit view', 'type' => MENU_DEFAULT_LOCAL_TASK, 'context' => MENU_CONTEXT_PAGE | MENU_CONTEXT_INLINE, - 'weight' => -10, 'theme callback' => 'ajax_base_page_theme', ) + $base; $items['admin/structure/views/view/%views_ui_cache/edit/%/ajax'] = array( @@ -170,17 +168,11 @@ function views_ui_menu() { ) + $base; // A page in the Reports section to show usage of fields in all views - $items['admin/reports/fields/list'] = array( - 'title' => 'List', - 'type' => MENU_DEFAULT_LOCAL_TASK, - 'weight' => -10, - ); $items['admin/reports/fields/views-fields'] = array( 'title' => 'Used in views', 'description' => 'Overview of fields used in all views.', 'page callback' => 'views_ui_field_list', 'type' => MENU_LOCAL_TASK, - 'weight' => 0, ) + $base; // A page in the Reports section to show usage of plugins in all views.