Commit 9020f773 authored by Dries's avatar Dries

- Patch #302149 by pwolanin: fixed confusing/duplicate use of names in menu admin.

parent a1674271
......@@ -1258,7 +1258,7 @@ function menu_list_system_menus() {
* Return an array of links to be rendered as the Main menu.
*/
function menu_main_menu() {
return menu_navigation_links(variable_get('menu_main_menu_source', 'main-menu'));
return menu_navigation_links(variable_get('menu_main_links_source', 'main-menu'));
}
/**
......@@ -1268,11 +1268,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_menu_source', 'secondary-menu') == variable_get('menu_main_menu_source', 'main-menu')) {
return menu_navigation_links(variable_get('menu_main_menu_source', 'main-menu'), 1);
if (variable_get('menu_secondary_links_source', 'secondary-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_menu_source', 'secondary-menu'), 0);
return menu_navigation_links(variable_get('menu_secondary_links_source', 'secondary-menu'), 0);
}
}
......
......@@ -612,25 +612,25 @@ function menu_configure() {
'#description' => t('Choose the menu to be the default in the menu options in the content authoring form.'),
);
$main = variable_get('menu_main_menu_source', 'main-menu');
$main_options = array_merge($menu_options, array('' => t('No Main menu')));
$form['menu_main_menu_source'] = array(
$main = variable_get('menu_main_links_source', 'main-menu');
$main_options = array_merge($menu_options, array('' => t('No Main links')));
$form['menu_main_links_source'] = array(
'#type' => 'select',
'#title' => t('Source for the Main menu'),
'#title' => t('Source for the Main links'),
'#default_value' => $main,
'#options' => $main_options,
'#tree' => FALSE,
'#description' => t('Select what should be displayed as the Main menu.'),
'#description' => t('Select what should be displayed as the Main links (typically at the top of the page).'),
);
$secondary_options = array_merge($menu_options, array('' => t('No Secondary menu')));
$form["menu_secondary_menu_source"] = array(
$secondary_options = array_merge($menu_options, array('' => t('No Secondary links')));
$form["menu_secondary_links_source"] = array(
'#type' => 'select',
'#title' => t('Source for the Secondary menu'),
'#default_value' => variable_get('menu_secondary_menu_source', 'secondary-menu'),
'#title' => t('Source for the Secondary links'),
'#default_value' => variable_get('menu_secondary_links_source', 'secondary-menu'),
'#options' => $secondary_options,
'#tree' => FALSE,
'#description' => t("Select the source for the Secondary menu. An advanced option allows you to use the same source for both Main menu (currently %main) and Secondary menu: if your source menu has two levels of hierarchy, the top level menu items will appear in the Main menu, and the children of the active item will appear in the Secondary menu." , array('%main' => $main_options[$main])),
'#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])),
);
return system_settings_form($form);
......
......@@ -10,7 +10,7 @@ function menu_install() {
$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. A typical representation of the Main menu would be tabs along the top.'));
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.'));
}
......
......@@ -3031,8 +3031,7 @@ function system_update_7008() {
*/
function system_update_7009() {
$ret = array();
$ret[] = update_sql("UPDATE {variable} SET name = 'menu_main_menu_source' WHERE name = 'menu_primary_links_source'");
$ret[] = update_sql("UPDATE {variable} SET name = 'menu_main_menu_source' WHERE name = 'menu_primary_links_source'");
$ret[] = update_sql("UPDATE {variable} SET name = 'menu_main_links_source' WHERE name = 'menu_primary_links_source'");
return $ret;
}
......
......@@ -153,6 +153,12 @@ function default_profile_tasks(&$task, $url) {
// Update the menu router information.
menu_rebuild();
// 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);
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment