From ea53aad7c8ced499e397cbedfe1e0cce205c071f Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Thu, 3 Nov 2005 19:33:37 +0000 Subject: - Patch #22215 by Richard Archer: refactored primary and secondary links. Deprecates the primary_links module. This patch was much needed. Thanks Richards! NOTE: if some themers could investigate if there is room for improvement with regard to theming, that would be awesome. --- modules/menu/menu.module | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) (limited to 'modules/menu/menu.module') diff --git a/modules/menu/menu.module b/modules/menu/menu.module index bed29b92a..e0a4b23c6 100644 --- a/modules/menu/menu.module +++ b/modules/menu/menu.module @@ -47,6 +47,11 @@ function menu_menu($may_cache) { 'callback' => 'menu_reset', 'access' => user_access('administer menu'), 'type' => MENU_LOCAL_TASK); + + $items[] = array('path' => 'admin/settings/menu', + 'title' => t('menus'), + 'callback' => 'menu_configure', + 'access' => user_access('administer menu')); } return $items; @@ -84,7 +89,50 @@ function menu_help($section) { return t('

Enter the name for your new menu. Remember to enable the newly created block in the %blocks administration page.

', array('%blocks' => l(t('blocks'), 'admin/block'))); case 'admin/menu/item/add': return t('

Enter the title, path, position and the weight for your new menu item.

'); + case 'admin/settings/menu': + return t('

Customize the menu settings.

'); + } +} + + +/** + * Menu callback; presents menu configuration options. + */ +function menu_configure() { + $menu = menu_get_menu(); + + $primary_options[0] = t('No primary links'); + foreach ($menu['items'][0]['children'] as $mid) { + $primary_options[$mid] = $menu['items'][$mid]['title']; } + + $form['settings_links'] = array('#type' => 'fieldset', '#title' => t('Primary links settings')); + $form['settings_links']['intro'] = array( + '#type' => 'markup', + '#value' => t('Primary links is a navigation system which usually (depending on your theme) appears at the top-right of the browser window. There are usually two rows of links, primary and secondary. You may control which links appear in this area by choosing a menu from which the links will be generated and then placing your links into the menu using the menu administration or the \'Menu settings\' pane on each edit node form.', array('%menu' => url('admin/menu'))) + ); + + $form['settings_links']['menu_primary_menu'] = array( + '#type' => 'select', + '#title' => t('Menu containing primary links'), + '#default_value' => variable_get('menu_primary_menu', 0), + '#options' => $primary_options + ); + + $secondary_options[0] = t('No secondary links'); + foreach ($menu['items'][0]['children'] as $mid) { + $secondary_options[$mid] = $menu['items'][$mid]['title']; + } + + $form['settings_links']['menu_secondary_menu'] = array( + '#type' => 'select', + '#title' => t('Menu containing secondary links'), + '#default_value' => variable_get('menu_secondary_menu', 0), + '#options' => $secondary_options, + '#description' => t('If you select the same menu as primary links then secondary links will display the appropriate second level of your navigation hierarchy.') + ); + + return system_settings_form('menu_configure', $form); } /** -- cgit v1.2.3