- Patch #273137 by pwolanin, David_Rothstein, chx, et al: split navigation to user and administration menu. Will require follow-up patches.
parent
c49a925eb8
commit
32076b4d32
|
@ -776,7 +776,7 @@ function menu_get_object($type = 'node', $position = 1, $path = NULL) {
|
|||
* @return
|
||||
* The rendered HTML of that menu on the current page.
|
||||
*/
|
||||
function menu_tree($menu_name = 'navigation') {
|
||||
function menu_tree($menu_name) {
|
||||
static $menu_output = array();
|
||||
|
||||
if (!isset($menu_output[$menu_name])) {
|
||||
|
@ -841,7 +841,7 @@ function menu_tree_output($tree) {
|
|||
* @return
|
||||
* An tree of menu links in an array, in the order they should be rendered.
|
||||
*/
|
||||
function menu_tree_all_data($menu_name = 'navigation', $item = NULL) {
|
||||
function menu_tree_all_data($menu_name, $item = NULL) {
|
||||
static $tree = array();
|
||||
|
||||
// Use $mlid as a flag for whether the data being loaded is for the whole tree.
|
||||
|
@ -937,7 +937,7 @@ function menu_tree_all_data($menu_name = 'navigation', $item = NULL) {
|
|||
* submenu below the link if there is one, and it is a subtree that has the
|
||||
* same structure described for the top-level array.
|
||||
*/
|
||||
function menu_tree_page_data($menu_name = 'navigation') {
|
||||
function menu_tree_page_data($menu_name) {
|
||||
static $tree = array();
|
||||
|
||||
// Load the menu item corresponding to the current page.
|
||||
|
@ -1332,7 +1332,7 @@ function menu_get_names($reset = FALSE) {
|
|||
* Return an array containing the names of system-defined (default) menus.
|
||||
*/
|
||||
function menu_list_system_menus() {
|
||||
return array('navigation', 'main-menu', 'secondary-menu');
|
||||
return array('navigation' => 'Navigation', 'management' => 'Management', 'user-menu' => 'User menu', 'main-menu' => 'Main menu', 'secondary-menu' => 'Secondary menu');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1349,11 +1349,11 @@ function menu_secondary_menu() {
|
|||
|
||||
// If the secondary menu source is set as the primary menu, we display the
|
||||
// second level of the primary menu.
|
||||
if (variable_get('menu_secondary_links_source', 'secondary-menu') == variable_get('menu_main_links_source', 'main-menu')) {
|
||||
if (variable_get('menu_secondary_links_source', 'user-menu') == variable_get('menu_main_links_source', 'main-menu')) {
|
||||
return menu_navigation_links(variable_get('menu_main_links_source', 'main-menu'), 1);
|
||||
}
|
||||
else {
|
||||
return menu_navigation_links(variable_get('menu_secondary_links_source', 'secondary-menu'), 0);
|
||||
return menu_navigation_links(variable_get('menu_secondary_links_source', 'user-menu'), 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1583,14 +1583,14 @@ function theme_menu_local_tasks() {
|
|||
/**
|
||||
* Set (or get) the active menu for the current page - determines the active trail.
|
||||
*/
|
||||
function menu_set_active_menu_name($menu_name = NULL) {
|
||||
function menu_set_active_menu_names($menu_names = NULL) {
|
||||
static $active;
|
||||
|
||||
if (isset($menu_name)) {
|
||||
$active = $menu_name;
|
||||
if (isset($menu_names) && is_array($menu_names)) {
|
||||
$active = $menu_names;
|
||||
}
|
||||
elseif (!isset($active)) {
|
||||
$active = 'navigation';
|
||||
$active = variable_get('menu_default_active_menus', array('management', 'navigation', 'user-menu', 'main-menu'));
|
||||
}
|
||||
return $active;
|
||||
}
|
||||
|
@ -1598,8 +1598,8 @@ function menu_set_active_menu_name($menu_name = NULL) {
|
|||
/**
|
||||
* Get the active menu for the current page - determines the active trail.
|
||||
*/
|
||||
function menu_get_active_menu_name() {
|
||||
return menu_set_active_menu_name();
|
||||
function menu_get_active_menu_names() {
|
||||
return menu_set_active_menu_names();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1650,9 +1650,26 @@ function menu_set_active_trail($new_trail = NULL) {
|
|||
$item = $root_item;
|
||||
}
|
||||
}
|
||||
|
||||
$tree = menu_tree_page_data(menu_get_active_menu_name());
|
||||
list($key, $curr) = each($tree);
|
||||
$menu_names = menu_get_active_menu_names();
|
||||
$curr = FALSE;
|
||||
// Determine if the current page is a link in any of the active menus.
|
||||
if ($menu_names) {
|
||||
$query = db_select('menu_links', 'ml');
|
||||
$query->fields('ml', array('menu_name'));
|
||||
$query->condition('ml.link_path', $item['href']);
|
||||
$query->condition('ml.menu_name', $menu_names, 'IN');
|
||||
$result = $query->execute();
|
||||
$found = array();
|
||||
foreach ($result as $menu) {
|
||||
$found[] = $menu->menu_name;
|
||||
}
|
||||
// The $menu_names array is ordered, so take the first one that matches.
|
||||
$name = current(array_intersect($menu_names, $found));
|
||||
if ($name !== FALSE) {
|
||||
$tree = menu_tree_page_data($name);
|
||||
list($key, $curr) = each($tree);
|
||||
}
|
||||
}
|
||||
|
||||
while ($curr) {
|
||||
// Terminate the loop when we find the current path in the active trail.
|
||||
|
@ -1863,7 +1880,6 @@ function _menu_navigation_links_rebuild($menu) {
|
|||
$menu_links = array();
|
||||
foreach ($menu as $path => $item) {
|
||||
if ($item['_visible']) {
|
||||
$item = _menu_link_build($item);
|
||||
$menu_links[$path] = $item;
|
||||
$sort[$path] = $item['_number_parts'];
|
||||
}
|
||||
|
@ -1882,7 +1898,7 @@ function _menu_navigation_links_rebuild($menu) {
|
|||
'has_children',
|
||||
'updated',
|
||||
))
|
||||
->condition('link_path', $item['link_path'])
|
||||
->condition('link_path', $item['path'])
|
||||
->condition('module', 'system')
|
||||
->execute()->fetchAssoc();
|
||||
if ($existing_item) {
|
||||
|
@ -1892,17 +1908,22 @@ function _menu_navigation_links_rebuild($menu) {
|
|||
$item['menu_name'] = $existing_item['menu_name'];
|
||||
$item['plid'] = $existing_item['plid'];
|
||||
}
|
||||
else {
|
||||
// If it moved, put it at the top level in the new menu.
|
||||
$item['plid'] = 0;
|
||||
}
|
||||
$item['has_children'] = $existing_item['has_children'];
|
||||
$item['updated'] = $existing_item['updated'];
|
||||
}
|
||||
if (!$existing_item || !$existing_item['customized']) {
|
||||
$item = _menu_link_build($item);
|
||||
menu_link_save($item);
|
||||
}
|
||||
}
|
||||
}
|
||||
$paths = array_keys($menu);
|
||||
// Updated and customized items whose router paths are gone need new ones.
|
||||
$result = db_select('menu_links')
|
||||
$result = db_select('menu_links', NULL, array('fetch' => PDO::FETCH_ASSOC))
|
||||
->fields('menu_links', array(
|
||||
'link_path',
|
||||
'mlid',
|
||||
|
@ -1927,7 +1948,7 @@ function _menu_navigation_links_rebuild($menu) {
|
|||
db_update('menu_links')
|
||||
->fields(array(
|
||||
'router_path' => $router_path,
|
||||
'updated' => $updated,
|
||||
'updated' => (int) $updated,
|
||||
))
|
||||
->condition('mlid', $item['mlid'])
|
||||
->execute();
|
||||
|
|
|
@ -16,7 +16,7 @@ class BlockTestCase extends DrupalWebTestCase {
|
|||
parent::setUp();
|
||||
|
||||
// Create and login user
|
||||
$admin_user = $this->drupalCreateUser(array('administer blocks', 'administer filters'));
|
||||
$admin_user = $this->drupalCreateUser(array('administer blocks', 'administer filters', 'access administration pages'));
|
||||
$this->drupalLogin($admin_user);
|
||||
|
||||
// Define the existing regions
|
||||
|
@ -88,8 +88,8 @@ class BlockTestCase extends DrupalWebTestCase {
|
|||
function testBlock() {
|
||||
// Select the Navigation block to be configured and moved.
|
||||
$block = array();
|
||||
$block['module'] = 'user';
|
||||
$block['delta'] = 'navigation';
|
||||
$block['module'] = 'system';
|
||||
$block['delta'] = 'management';
|
||||
$block['title'] = $this->randomName(8);
|
||||
|
||||
// Set block title to confirm that interface works and override any custom titles.
|
||||
|
|
|
@ -161,7 +161,6 @@ class BlogTestCase extends DrupalWebTestCase {
|
|||
// Confirm a blog page was displayed per user.
|
||||
$this->drupalGet('blog/' . $user->uid);
|
||||
$this->assertTitle(t("@name's blog | Drupal", array('@name' => $user->name)), t('User blog node was displayed'));
|
||||
$this->assertText(t('Home ' . $crumb . ' Blogs'), t('Breadcrumbs were displayed'));
|
||||
|
||||
// Confirm a blog feed was displayed.
|
||||
$this->drupalGet('blog/feed');
|
||||
|
|
|
@ -173,7 +173,7 @@ function theme_menu_overview_form($form) {
|
|||
drupal_add_tabledrag('menu-overview', 'order', 'sibling', 'menu-weight');
|
||||
|
||||
$header = array(
|
||||
t('Menu item'),
|
||||
t('Menu link'),
|
||||
array('data' => t('Enabled'), 'class' => 'checkbox'),
|
||||
array('data' => t('Expanded'), 'class' => 'checkbox'),
|
||||
t('Weight'),
|
||||
|
@ -293,27 +293,27 @@ function menu_edit_item(&$form_state, $type, $item, $menu) {
|
|||
'#type' => 'checkbox',
|
||||
'#title' => t('Enabled'),
|
||||
'#default_value' => !$item['hidden'],
|
||||
'#description' => t('Menu items that are not enabled will not be listed in any menu.'),
|
||||
'#description' => t('Menu links that are not enabled will not be listed in any menu.'),
|
||||
);
|
||||
$form['menu']['expanded'] = array(
|
||||
'#type' => 'checkbox',
|
||||
'#title' => t('Expanded'),
|
||||
'#default_value' => $item['expanded'],
|
||||
'#description' => t('If selected and this menu item has children, the menu will always appear expanded.'),
|
||||
'#description' => t('If selected and this menu link has children, the menu will always appear expanded.'),
|
||||
);
|
||||
|
||||
// Generate a list of possible parents (not including this item or descendants).
|
||||
$options = menu_parent_options(menu_get_menus(), $item);
|
||||
$default = $item['menu_name'] . ':' . $item['plid'];
|
||||
if (!isset($options[$default])) {
|
||||
$default = 'navigation:0';
|
||||
$default = 'main-menu:0';
|
||||
}
|
||||
$form['menu']['parent'] = array(
|
||||
'#type' => 'select',
|
||||
'#title' => t('Parent item'),
|
||||
'#title' => t('Parent link'),
|
||||
'#default_value' => $default,
|
||||
'#options' => $options,
|
||||
'#description' => t('The maximum depth for an item and all its children is fixed at !maxdepth. Some menu items may not be available as parents if selecting them would exceed this limit.', array('!maxdepth' => MENU_MAX_DEPTH)),
|
||||
'#description' => t('The maximum depth for a link and all its children is fixed at !maxdepth. Some menu links may not be available as parents if selecting them would exceed this limit.', array('!maxdepth' => MENU_MAX_DEPTH)),
|
||||
'#attributes' => array('class' => 'menu-title-select'),
|
||||
);
|
||||
$form['menu']['weight'] = array(
|
||||
|
@ -386,13 +386,14 @@ function menu_edit_item_submit($form, &$form_state) {
|
|||
* Menu callback; Build the form that handles the adding/editing of a custom menu.
|
||||
*/
|
||||
function menu_edit_menu(&$form_state, $type, $menu = array()) {
|
||||
$system_menus = menu_list_system_menus();
|
||||
if ($type == 'edit') {
|
||||
$form['menu_name'] = array('#type' => 'value', '#value' => $menu['menu_name']);
|
||||
$form['#insert'] = FALSE;
|
||||
$form['delete'] = array(
|
||||
'#type' => 'submit',
|
||||
'#value' => t('Delete'),
|
||||
'#access' => !in_array($menu['menu_name'], menu_list_system_menus()),
|
||||
'#access' => !isset($system_menus[$menu['menu_name']]),
|
||||
'#submit' => array('menu_custom_delete_submit'),
|
||||
'#weight' => 10,
|
||||
);
|
||||
|
@ -409,12 +410,20 @@ function menu_edit_menu(&$form_state, $type, $menu = array()) {
|
|||
$form['#insert'] = TRUE;
|
||||
}
|
||||
$form['#title'] = $menu['title'];
|
||||
$form['title'] = array(
|
||||
'#type' => 'textfield',
|
||||
'#title' => t('Title'),
|
||||
'#default_value' => $menu['title'],
|
||||
'#required' => TRUE,
|
||||
);
|
||||
if (isset($system_menus[$menu['menu_name']])) {
|
||||
$form['title'] = array(
|
||||
'#type' => 'value',
|
||||
'#value' => $menu['title'],
|
||||
);
|
||||
}
|
||||
else {
|
||||
$form['title'] = array(
|
||||
'#type' => 'textfield',
|
||||
'#title' => t('Title'),
|
||||
'#default_value' => $menu['title'],
|
||||
'#required' => TRUE,
|
||||
);
|
||||
}
|
||||
$form['description'] = array(
|
||||
'#type' => 'textarea',
|
||||
'#title' => t('Description'),
|
||||
|
@ -440,7 +449,8 @@ function menu_custom_delete_submit($form, &$form_state) {
|
|||
*/
|
||||
function menu_delete_menu_page($menu) {
|
||||
// System-defined menus may not be deleted.
|
||||
if (in_array($menu['menu_name'], menu_list_system_menus())) {
|
||||
$system_menus = menu_list_system_menus();
|
||||
if (isset($system_menus[$menu['menu_name']])) {
|
||||
drupal_access_denied();
|
||||
return;
|
||||
}
|
||||
|
@ -468,7 +478,8 @@ function menu_delete_menu_confirm_submit($form, &$form_state) {
|
|||
$menu = $form['#menu'];
|
||||
$form_state['redirect'] = 'admin/build/menu';
|
||||
// System-defined menus may not be deleted - only menus defined by this module.
|
||||
if (in_array($menu['menu_name'], menu_list_system_menus()) || !db_result(db_query("SELECT COUNT(*) FROM {menu_custom} WHERE menu_name = '%s'", $menu['menu_name']))) {
|
||||
$system_menus = menu_list_system_menus();
|
||||
if (isset($system_menus[$menu['menu_name']]) || !(db_query("SELECT 1 FROM {menu_custom} WHERE menu_name = :name", array('name' => $menu['menu_name']))->fetchField())) {
|
||||
return;
|
||||
}
|
||||
// Reset all the menu links defined by the system via hook_menu.
|
||||
|
@ -618,7 +629,7 @@ function menu_configure() {
|
|||
$form['menu_main_links_source'] = array(
|
||||
'#type' => 'select',
|
||||
'#title' => t('Source for the Main links'),
|
||||
'#default_value' => $main,
|
||||
'#default_value' => 'main-menu',
|
||||
'#options' => $main_options,
|
||||
'#tree' => FALSE,
|
||||
'#description' => t('Select what should be displayed as the Main links (typically at the top of the page).'),
|
||||
|
@ -628,7 +639,7 @@ function menu_configure() {
|
|||
$form["menu_secondary_links_source"] = array(
|
||||
'#type' => 'select',
|
||||
'#title' => t('Source for the Secondary links'),
|
||||
'#default_value' => 'secondary-menu',
|
||||
'#default_value' => 'user-menu',
|
||||
'#options' => $secondary_options,
|
||||
'#tree' => FALSE,
|
||||
'#description' => t("Select the source for the Secondary links. An advanced option allows you to use the same source for both Main links (currently %main) and Secondary links: if your source menu has two levels of hierarchy, the top level menu links will appear in the Main links, and the children of the active link will appear in the Secondary links." , array('%main' => $main_options[$main])),
|
||||
|
|
|
@ -7,11 +7,19 @@
|
|||
function menu_install() {
|
||||
// Create tables.
|
||||
drupal_install_schema('menu');
|
||||
|
||||
$system_menus = menu_list_system_menus();
|
||||
$descriptions = array(
|
||||
'navigation' => 'The <em>Navigation</em> menu contains links such as Recent posts (if the Tracker module is enabled). Non-administrative links are added to this menu by default by modules.',
|
||||
'user-menu' => "The <em>User menu</em> contains links to the user's account, and 'Log out' and is the source for the User links that may be displayed by the theme.",
|
||||
'management' => 'The <em>Management</em> menu contains links for content creation, site building, user management, and similar site activites.',
|
||||
'main-menu' => 'The <em>Main menu</em> is the default source for the Main links which are often used by themes to show the major sections of a site.',
|
||||
'secondary-menu' => 'The <em>Secondary menu</em> is the default source for the Secondary links which are often used for legal notices, contact details, and other navigation items that play a lesser role than the Main links.',
|
||||
);
|
||||
$t = get_t();
|
||||
db_query("INSERT INTO {menu_custom} (menu_name, title, description) VALUES ('%s', '%s', '%s')", 'navigation', $t('Navigation'), $t('The navigation menu is provided by Drupal and is the main interactive menu for any site. It is usually the only menu that contains personalized links for authenticated users, and is often not even visible to anonymous users.'));
|
||||
db_query("INSERT INTO {menu_custom} (menu_name, title, description) VALUES ('%s', '%s', '%s')", 'main-menu', $t('Main menu'), $t('The Main menu is often used by themes to show the major sections of a site.'));
|
||||
db_query("INSERT INTO {menu_custom} (menu_name, title, description) VALUES ('%s', '%s', '%s')", 'secondary-menu', $t('Secondary menu'), $t('The Secondary menu is often used for pages like legal notices, contact details, and other navigation items that play a lesser role than the Main menu.'));
|
||||
$query = db_insert('menu_custom')->fields(array('menu_name', 'title', 'description'));
|
||||
foreach ($system_menus as $menu_name => $title) {
|
||||
$query->values(array('menu_name' => $menu_name, 'title' => $t($title), 'description' => $t($descriptions[$menu_name])))->execute();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -18,18 +18,18 @@ define('MENU_MAX_MENU_NAME_LENGTH_UI', 27);
|
|||
function menu_help($path, $arg) {
|
||||
switch ($path) {
|
||||
case 'admin/help#menu':
|
||||
$output = '<p>' . t("The menu module provides an interface to control and customize Drupal's powerful menu system. Menus are a hierarchical collection of links, or menu items, used to navigate a website, and are positioned and displayed using Drupal's flexible block system. By default, three menus are created during installation: <em>Navigation</em>, <em>Main menu</em>, and <em>Secondary menu</em>. The <em>Navigation</em> menu contains most links necessary for working with and navigating your site, and is often displayed in either the left or right sidebar. Most Drupal themes also provide support for the <em>Main menu</em> and <em>Secondary menu</em>, by displaying them in either the header or footer of each page. By default, the <em>Main menu</em> and <em>Secondary menu</em> contain no menu items but may be configured to contain custom menu items specific to your site.") . '</p>';
|
||||
$output .= '<p>' . t('The <a href="@menu">menus page</a> displays all menus currently available on your site. Select a menu from this list to add or edit a menu item, or to rearrange items within the menu. Create new menus using the <a href="@add-menu">add menu page</a> (the block containing a new menu must also be enabled on the <a href="@blocks">blocks administration page</a>).', array('@menu' => url('admin/build/menu'), '@add-menu' => url('admin/build/menu/add'), '@blocks' => url('admin/build/block'))) . '</p>';
|
||||
$output = '<p>' . t("The menu module provides an interface to control and customize Drupal's powerful menu system. Menus are a hierarchical collection of links used to navigate a website. Each menu is rendered in a block that may be positioned and displayed using Drupal's flexible block system. Five menus are provided by Drupal and are always present: <em>Navigation</em>, <em>Management</em>, <em>User menu</em>, <em>Main menu</em>, and <em>Secondary menu</em>. The <em>Management</em> menu contains links for administration and content creation, while the <em>Navigation</em> menu is the default location for site navigation links created by newly enabled modules. Both of these are often displayed in either the left or right sidebar. Most Drupal themes also provide support for the <em>Main links</em> and <em>Secondary links</em>, by displaying them in either the header or footer of each page. The <em>Main menu</em> is the default source for the <em>Main links</em> and the <em>User menu</em> is the default source for the <em>Secondary links</em>. By default, the <em>User menu</em> has links to take the current user to their account or allow them to log out, while the <em>Main menu</em> and <em>Secondary menu</em> contain no menu links but may be configured to contain custom menu items specific to your site. You may create an unlimited number of additional menus, each of which will automatically have an associated block.") . '</p>';
|
||||
$output .= '<p>' . t('The <a href="@menu">menus page</a> displays all menus currently available on your site. Select a menu from this list to add or edit a menu link, or to rearrange links within the menu. Create new menus using the <a href="@add-menu">add menu page</a> (the block containing a new menu must also be enabled on the <a href="@blocks">blocks administration page</a>).', array('@menu' => url('admin/build/menu'), '@add-menu' => url('admin/build/menu/add'), '@blocks' => url('admin/build/block'))) . '</p>';
|
||||
$output .= '<p>' . t('For more information, see the online handbook entry for <a href="@menu">Menu module</a>.', array('@menu' => 'http://drupal.org/handbook/modules/menu/')) . '</p>';
|
||||
return $output;
|
||||
case 'admin/build/menu':
|
||||
return '<p>' . t('Menus are a collection of links (menu items) used to navigate a website. The menus currently available on your site are displayed below. Select a menu from this list to manage its menu items.') . '</p>';
|
||||
return '<p>' . t('Menus are a collection of links used to navigate a website. If the Block module is enabled, each menu has a corresponding block that is managed on the <a href="@blocks">blocks administration page</a>. Select an existing menu from this list to manage its menu links.', array('@blocks' => url('admin/build/block'))) . '</p>';
|
||||
case 'admin/build/menu/add':
|
||||
return '<p>' . t('Enter the name for your new menu. Remember to enable the newly created block in the <a href="@blocks">blocks administration page</a>.', array('@blocks' => url('admin/build/block'))) . '</p>';
|
||||
case 'admin/build/menu-customize/%':
|
||||
return '<p>' . t('To rearrange menu items, grab a drag-and-drop handle under the <em>Menu item</em> column and drag the items (or group of items) to a new location in the list. (Grab a handle by clicking and holding the mouse while hovering over a handle icon.) Remember that your changes will not be saved until you click the <em>Save configuration</em> button at the bottom of the page.') . '</p>';
|
||||
return '<p>' . t('To rearrange menu links, grab a drag-and-drop handle under the <em>Menu link</em> column and drag the link (or group of links) to a new location in the list. (Grab a handle by clicking and holding the mouse while hovering over a handle icon.) Remember that your changes will not be saved until you click the <em>Save configuration</em> button at the bottom of the page.') . '</p>';
|
||||
case 'admin/build/menu/item/add':
|
||||
return '<p>' . t('Enter the title and path for your new menu item.') . '</p>';
|
||||
return '<p>' . t('Enter the title and path for your new menu link.') . '</p>';
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -86,12 +86,12 @@ function menu_menu() {
|
|||
'type' => MENU_CALLBACK,
|
||||
);
|
||||
$items['admin/build/menu-customize/%menu/list'] = array(
|
||||
'title' => 'List items',
|
||||
'title' => 'List links',
|
||||
'weight' => -10,
|
||||
'type' => MENU_DEFAULT_LOCAL_TASK,
|
||||
);
|
||||
$items['admin/build/menu-customize/%menu/add'] = array(
|
||||
'title' => 'Add item',
|
||||
'title' => 'Add link',
|
||||
'page callback' => 'drupal_get_form',
|
||||
'page arguments' => array('menu_edit_item', 'add', NULL, 3),
|
||||
'access arguments' => array('administer menu'),
|
||||
|
@ -112,21 +112,21 @@ function menu_menu() {
|
|||
'type' => MENU_CALLBACK,
|
||||
);
|
||||
$items['admin/build/menu/item/%menu_link/edit'] = array(
|
||||
'title' => 'Edit menu item',
|
||||
'title' => 'Edit menu link',
|
||||
'page callback' => 'drupal_get_form',
|
||||
'page arguments' => array('menu_edit_item', 'edit', 4, NULL),
|
||||
'access arguments' => array('administer menu'),
|
||||
'type' => MENU_CALLBACK,
|
||||
);
|
||||
$items['admin/build/menu/item/%menu_link/reset'] = array(
|
||||
'title' => 'Reset menu item',
|
||||
'title' => 'Reset menu link',
|
||||
'page callback' => 'drupal_get_form',
|
||||
'page arguments' => array('menu_reset_item_confirm', 4),
|
||||
'access arguments' => array('administer menu'),
|
||||
'type' => MENU_CALLBACK,
|
||||
);
|
||||
$items['admin/build/menu/item/%menu_link/delete'] = array(
|
||||
'title' => 'Delete menu item',
|
||||
'title' => 'Delete menu link',
|
||||
'page callback' => 'menu_item_delete_page',
|
||||
'page arguments' => array(4),
|
||||
'access arguments' => array('administer menu'),
|
||||
|
@ -260,9 +260,7 @@ function menu_reset_item($item) {
|
|||
* Implementation of hook_block_list().
|
||||
*/
|
||||
function menu_block_list() {
|
||||
$menus = menu_get_menus();
|
||||
// The Navigation menu is handled by the user module.
|
||||
unset($menus['navigation']);
|
||||
$menus = menu_get_menus(FALSE);
|
||||
|
||||
$blocks = array();
|
||||
foreach ($menus as $name => $title) {
|
||||
|
@ -279,10 +277,7 @@ function menu_block_list() {
|
|||
* Implementation of hook_block_view().
|
||||
*/
|
||||
function menu_block_view($delta = '') {
|
||||
$menus = menu_get_menus();
|
||||
// The Navigation menu is handled by the user module.
|
||||
unset($menus['navigation']);
|
||||
|
||||
$menus = menu_get_menus(FALSE);
|
||||
$data['subject'] = check_plain($menus[$delta]);
|
||||
$data['content'] = menu_tree($delta);
|
||||
return $data;
|
||||
|
@ -469,7 +464,7 @@ function menu_node_form_submit($form, &$form_state) {
|
|||
* titles as the values.
|
||||
*/
|
||||
function menu_get_menus($all = TRUE) {
|
||||
$system_menus = menu_list_system_menus();
|
||||
$system_menus = array_keys(menu_list_system_menus());
|
||||
$query = db_select('menu_custom');
|
||||
$query->addField('menu_custom', 'menu_name', 'menu_name');
|
||||
$query->addField('menu_custom', 'title', 'title');
|
||||
|
|
|
@ -1737,6 +1737,7 @@ function node_menu() {
|
|||
'page callback' => 'node_add_page',
|
||||
'access callback' => '_node_add_access',
|
||||
'weight' => 1,
|
||||
'menu_name' => 'management',
|
||||
);
|
||||
$items['rss.xml'] = array(
|
||||
'title' => 'RSS feed',
|
||||
|
|
|
@ -53,7 +53,7 @@ class SessionTestCase extends DrupalWebTestCase {
|
|||
'pass' => $user->pass_raw
|
||||
);
|
||||
$this->drupalPost('user', $edit, t('Log in'));
|
||||
$this->drupalGet('node');
|
||||
$this->drupalGet('user');
|
||||
$pass = $this->assertText($user->name, t('Found name: %name', array('%name' => $user->name)), t('User login'));
|
||||
$this->_logged_in = $pass;
|
||||
|
||||
|
|
|
@ -458,6 +458,7 @@ function system_menu() {
|
|||
'access arguments' => array('access administration pages'),
|
||||
'page callback' => 'system_main_admin_page',
|
||||
'weight' => 9,
|
||||
'menu_name' => 'management',
|
||||
);
|
||||
$items['admin/compact'] = array(
|
||||
'title' => 'Compact mode',
|
||||
|
@ -880,13 +881,19 @@ function system_user_timezone(&$edit, &$form) {
|
|||
* Implementation of hook_block_list().
|
||||
*/
|
||||
function system_block_list() {
|
||||
$image_path = 'misc/' . variable_get('drupal_badge_color', 'powered-blue') . '-' . variable_get('drupal_badge_size', '80x15') . '.png';
|
||||
$blocks['powered-by'] = array(
|
||||
'info' => t('Powered by Drupal'),
|
||||
'weight' => '10',
|
||||
// Not worth caching.
|
||||
'cache' => BLOCK_NO_CACHE,
|
||||
);
|
||||
// System-defined menu blocks.
|
||||
foreach (menu_list_system_menus() as $menu_name => $title) {
|
||||
$blocks[$menu_name]['info'] = t($title);
|
||||
// Menu blocks can't be cached because each menu item can have
|
||||
// a custom access callback. menu.inc manages its own caching.
|
||||
$blocks[$menu_name]['cache'] = BLOCK_NO_CACHE;
|
||||
}
|
||||
return $blocks;
|
||||
}
|
||||
|
||||
|
@ -929,13 +936,28 @@ function system_block_save($delta = '', $edit = NULL) {
|
|||
/**
|
||||
* Implementation of hook_block_view().
|
||||
*
|
||||
* Generate a block with a promotional link to Drupal.org.
|
||||
* Generate a block with a promotional link to Drupal.org and
|
||||
* all system menu blocks.
|
||||
*/
|
||||
function system_block_view($delta = '') {
|
||||
$image_path = 'misc/' . variable_get('drupal_badge_color', 'powered-blue') . '-' . variable_get('drupal_badge_size', '80x15') . '.png';
|
||||
$block['subject'] = NULL; // Don't display a title
|
||||
$block['content'] = theme('system_powered_by', $image_path);
|
||||
return $block;
|
||||
$block = array();
|
||||
switch ($delta) {
|
||||
case 'powered-by':
|
||||
$image_path = 'misc/' . variable_get('drupal_badge_color', 'powered-blue') . '-' . variable_get('drupal_badge_size', '80x15') . '.png';
|
||||
// Don't display a title.
|
||||
$block['subject'] = NULL;
|
||||
$block['content'] = theme('system_powered_by', $image_path);
|
||||
return $block;
|
||||
default:
|
||||
// All system menu blocks.
|
||||
$system_menus = menu_list_system_menus();
|
||||
if (isset($system_menus[$delta])) {
|
||||
$block['subject'] = t($system_menus[$delta]);
|
||||
$block['content'] = menu_tree($delta);
|
||||
return $block;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1013,11 +1013,6 @@ function user_block_list() {
|
|||
// Not worth caching.
|
||||
$blocks['login']['cache'] = BLOCK_NO_CACHE;
|
||||
|
||||
$blocks['navigation']['info'] = t('Navigation');
|
||||
// Menu blocks can't be cached because each menu item can have
|
||||
// a custom access callback. menu.inc manages its own caching.
|
||||
$blocks['navigation']['cache'] = BLOCK_NO_CACHE;
|
||||
|
||||
$blocks['new']['info'] = t('Who\'s new');
|
||||
|
||||
// Too dynamic to cache.
|
||||
|
@ -1087,13 +1082,6 @@ function user_block_view($delta = '') {
|
|||
}
|
||||
return $block;
|
||||
|
||||
case 'navigation':
|
||||
if ($menu = menu_tree()) {
|
||||
$block['subject'] = $user->uid ? check_plain($user->name) : t('Navigation');
|
||||
$block['content'] = $menu;
|
||||
}
|
||||
return $block;
|
||||
|
||||
case 'new':
|
||||
if (user_access('access content')) {
|
||||
// Retrieve a list of new users who have subsequently accessed the site successfully.
|
||||
|
@ -1306,6 +1294,7 @@ function user_menu() {
|
|||
'access callback' => 'user_is_logged_in',
|
||||
'page callback' => 'user_logout',
|
||||
'weight' => 10,
|
||||
'menu_name' => 'user-menu',
|
||||
);
|
||||
|
||||
// User administration pages.
|
||||
|
@ -1372,7 +1361,8 @@ function user_menu() {
|
|||
'page arguments' => array(1),
|
||||
'access callback' => 'user_view_access',
|
||||
'access arguments' => array(1),
|
||||
'parent' => '',
|
||||
'weight' => -10,
|
||||
'menu_name' => 'user-menu',
|
||||
);
|
||||
|
||||
$items['user/%user/view'] = array(
|
||||
|
|
|
@ -91,9 +91,10 @@ function default_profile_task_list() {
|
|||
*/
|
||||
function default_profile_tasks(&$task, $url) {
|
||||
|
||||
// Enable 3 standard blocks.
|
||||
// Enable 4 standard blocks.
|
||||
db_query("INSERT INTO {block} (module, delta, theme, status, weight, region, pages, cache) VALUES ('%s', '%s', '%s', %d, %d, '%s', '%s', %d)", 'user', 'login', 'garland', 1, 0, 'left', '', -1);
|
||||
db_query("INSERT INTO {block} (module, delta, theme, status, weight, region, pages, cache) VALUES ('%s', '%s', '%s', %d, %d, '%s', '%s', %d)", 'user', 'navigation', 'garland', 1, 0, 'left', '', -1);
|
||||
db_query("INSERT INTO {block} (module, delta, theme, status, weight, region, pages, cache) VALUES ('%s', '%s', '%s', %d, %d, '%s', '%s', %d)", 'system', 'navigation', 'garland', 1, 0, 'left', '', -1);
|
||||
db_query("INSERT INTO {block} (module, delta, theme, status, weight, region, pages, cache) VALUES ('%s', '%s', '%s', %d, %d, '%s', '%s', %d)", 'system', 'management', 'garland', 1, 1, 'left', '', -1);
|
||||
db_query("INSERT INTO {block} (module, delta, theme, status, weight, region, pages, cache) VALUES ('%s', '%s', '%s', %d, %d, '%s', '%s', %d)", 'system', 'powered-by', 'garland', 1, 10, 'footer', '', -1);
|
||||
|
||||
// Insert default user-defined node types into the database. For a complete
|
||||
|
@ -156,8 +157,6 @@ function default_profile_tasks(&$task, $url) {
|
|||
// Save some default links.
|
||||
$link = array('link_path' => 'admin/build/menu-customize/main-menu/add', 'link_title' => 'Add a main menu link', 'menu_name' => 'main-menu');
|
||||
menu_link_save($link);
|
||||
$link = array('link_path' => 'admin/build/menu-customize/secondary-menu/add', 'link_title' => 'Add a secondary menu link', 'menu_name' => 'secondary-menu');
|
||||
menu_link_save($link);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -42,9 +42,10 @@ function expert_profile_task_list() {
|
|||
* Perform any final installation tasks for this profile.
|
||||
*/
|
||||
function expert_profile_tasks(&$task, $url) {
|
||||
// Enable 2 standard blocks.
|
||||
// Enable 3 standard blocks.
|
||||
db_query("INSERT INTO {block} (module, delta, theme, status, weight, region, pages, cache) VALUES ('%s', '%s', '%s', %d, %d, '%s', '%s', %d)", 'user', 'login', 'garland', 1, 0, 'left', '', -1);
|
||||
db_query("INSERT INTO {block} (module, delta, theme, status, weight, region, pages, cache) VALUES ('%s', '%s', '%s', %d, %d, '%s', '%s', %d)", 'user', 'navigation', 'garland', 1, 0, 'left', '', -1);
|
||||
db_query("INSERT INTO {block} (module, delta, theme, status, weight, region, pages, cache) VALUES ('%s', '%s', '%s', %d, %d, '%s', '%s', %d)", 'system', 'navigation', 'garland', 1, 0, 'left', '', -1);
|
||||
db_query("INSERT INTO {block} (module, delta, theme, status, weight, region, pages, cache) VALUES ('%s', '%s', '%s', %d, %d, '%s', '%s', %d)", 'system', 'management', 'garland', 1, 1, 'left', '', -1);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue