00001 <?php
00002
00003
00012 function menu_overview_page() {
00013 $result = db_query("SELECT * FROM {menu_custom} ORDER BY title");
00014 $content = array();
00015 while ($menu = db_fetch_array($result)) {
00016 $menu['href'] = 'admin/build/menu-customize/' . $menu['menu_name'];
00017 $menu['localized_options'] = array();
00018 $content[] = $menu;
00019 }
00020 return theme('admin_block_content', $content);
00021 }
00022
00029 function menu_overview_form(&$form_state, $menu) {
00030 global $menu_admin;
00031 $sql = "
00032 SELECT m.load_functions, m.to_arg_functions, m.access_callback, m.access_arguments, m.page_callback, m.page_arguments, m.title, m.title_callback, m.title_arguments, m.type, m.description, ml.*
00033 FROM {menu_links} ml LEFT JOIN {menu_router} m ON m.path = ml.router_path
00034 WHERE ml.menu_name = '%s'
00035 ORDER BY p1 ASC, p2 ASC, p3 ASC, p4 ASC, p5 ASC, p6 ASC, p7 ASC, p8 ASC, p9 ASC";
00036 $result = db_query($sql, $menu['menu_name']);
00037 $tree = menu_tree_data($result);
00038 $node_links = array();
00039 menu_tree_collect_node_links($tree, $node_links);
00040
00041 $menu_admin = TRUE;
00042 menu_tree_check_access($tree, $node_links);
00043 $menu_admin = FALSE;
00044
00045 $form = _menu_overview_tree_form($tree);
00046 $form['#menu'] = $menu;
00047 if (element_children($form)) {
00048 $form['submit'] = array(
00049 '#type' => 'submit',
00050 '#value' => t('Save configuration'),
00051 );
00052 }
00053 else {
00054 $form['empty_menu'] = array('#value' => t('There are no menu items yet.'));
00055 }
00056 return $form;
00057 }
00058
00062 function _menu_overview_tree_form($tree) {
00063 static $form = array('#tree' => TRUE);
00064 foreach ($tree as $data) {
00065 $title = '';
00066 $item = $data['link'];
00067
00068 if ($item && $item['hidden'] >= 0) {
00069 $mlid = 'mlid:' . $item['mlid'];
00070 $form[$mlid]['#item'] = $item;
00071 $form[$mlid]['#attributes'] = $item['hidden'] ? array('class' => 'menu-disabled') : array('class' => 'menu-enabled');
00072 $form[$mlid]['title']['#value'] = l($item['title'], $item['href'], $item['localized_options']) . ($item['hidden'] ? ' (' . t('disabled') . ')' : '');
00073 $form[$mlid]['hidden'] = array(
00074 '#type' => 'checkbox',
00075 '#default_value' => !$item['hidden'],
00076 );
00077 $form[$mlid]['expanded'] = array(
00078 '#type' => 'checkbox',
00079 '#default_value' => $item['expanded'],
00080 );
00081 $form[$mlid]['weight'] = array(
00082 '#type' => 'weight',
00083 '#delta' => 50,
00084 '#default_value' => isset($form_state[$mlid]['weight']) ? $form_state[$mlid]['weight'] : $item['weight'],
00085 );
00086 $form[$mlid]['mlid'] = array(
00087 '#type' => 'hidden',
00088 '#value' => $item['mlid'],
00089 );
00090 $form[$mlid]['plid'] = array(
00091 '#type' => 'textfield',
00092 '#default_value' => isset($form_state[$mlid]['plid']) ? $form_state[$mlid]['plid'] : $item['plid'],
00093 '#size' => 6,
00094 );
00095
00096 $operations = array();
00097 $operations['edit'] = l(t('edit'), 'admin/build/menu/item/' . $item['mlid'] . '/edit');
00098
00099 if ($item['module'] == 'menu' || $item['updated'] == 1) {
00100 $operations['delete'] = l(t('delete'), 'admin/build/menu/item/' . $item['mlid'] . '/delete');
00101 }
00102
00103 elseif ($item['module'] == 'system' && $item['customized']) {
00104 $operations['reset'] = l(t('reset'), 'admin/build/menu/item/' . $item['mlid'] . '/reset');
00105 }
00106
00107 $form[$mlid]['operations'] = array();
00108 foreach ($operations as $op => $value) {
00109 $form[$mlid]['operations'][$op] = array('#value' => $value);
00110 }
00111 }
00112
00113 if ($data['below']) {
00114 _menu_overview_tree_form($data['below']);
00115 }
00116 }
00117 return $form;
00118 }
00119
00128 function menu_overview_form_submit($form, &$form_state) {
00129
00130
00131
00132
00133
00134
00135 $order = array_flip(array_keys($form['#post']));
00136 $form = array_merge($order, $form);
00137
00138 $updated_items = array();
00139 $fields = array('expanded', 'weight', 'plid');
00140 foreach (element_children($form) as $mlid) {
00141 if (isset($form[$mlid]['#item'])) {
00142 $element = $form[$mlid];
00143
00144 foreach ($fields as $field) {
00145 if ($element[$field]['#value'] != $element[$field]['#default_value']) {
00146 $element['#item'][$field] = $element[$field]['#value'];
00147 $updated_items[$mlid] = $element['#item'];
00148 }
00149 }
00150
00151 if ($element['hidden']['#value'] != $element['hidden']['#default_value']) {
00152 $element['#item']['hidden'] = !$element['hidden']['#value'];
00153 $updated_items[$mlid] = $element['#item'];
00154 }
00155 }
00156 }
00157
00158
00159 foreach ($updated_items as $item) {
00160 $item['customized'] = 1;
00161 menu_link_save($item);
00162 }
00163 }
00164
00170 function theme_menu_overview_form($form) {
00171 drupal_add_tabledrag('menu-overview', 'match', 'parent', 'menu-plid', 'menu-plid', 'menu-mlid', TRUE, MENU_MAX_DEPTH - 1);
00172 drupal_add_tabledrag('menu-overview', 'order', 'sibling', 'menu-weight');
00173
00174 $header = array(
00175 t('Menu item'),
00176 array('data' => t('Enabled'), 'class' => 'checkbox'),
00177 array('data' => t('Expanded'), 'class' => 'checkbox'),
00178 t('Weight'),
00179 array('data' => t('Operations'), 'colspan' => '3'),
00180 );
00181
00182 $rows = array();
00183 foreach (element_children($form) as $mlid) {
00184 if (isset($form[$mlid]['hidden'])) {
00185 $element = &$form[$mlid];
00186
00187 $operations = array();
00188 foreach (element_children($element['operations']) as $op) {
00189 $operations[] = drupal_render($element['operations'][$op]);
00190 }
00191 while (count($operations) < 2) {
00192 $operations[] = '';
00193 }
00194
00195
00196 $element['plid']['#attributes']['class'] = 'menu-plid';
00197 $element['mlid']['#attributes']['class'] = 'menu-mlid';
00198 $element['weight']['#attributes']['class'] = 'menu-weight';
00199
00200
00201 $element['plid']['#type'] = 'hidden';
00202
00203 $row = array();
00204 $row[] = theme('indentation', $element['#item']['depth'] - 1) . drupal_render($element['title']);
00205 $row[] = array('data' => drupal_render($element['hidden']), 'class' => 'checkbox');
00206 $row[] = array('data' => drupal_render($element['expanded']), 'class' => 'checkbox');
00207 $row[] = drupal_render($element['weight']) . drupal_render($element['plid']) . drupal_render($element['mlid']);
00208 $row = array_merge($row, $operations);
00209
00210 $row = array_merge(array('data' => $row), $element['#attributes']);
00211 $row['class'] = !empty($row['class']) ? $row['class'] . ' draggable' : 'draggable';
00212 $rows[] = $row;
00213 }
00214 }
00215 $output = '';
00216 if ($rows) {
00217 $output .= theme('table', $header, $rows, array('id' => 'menu-overview'));
00218 }
00219 $output .= drupal_render($form);
00220 return $output;
00221 }
00222
00226 function menu_edit_item(&$form_state, $type, $item, $menu) {
00227
00228 $form['menu'] = array(
00229 '#type' => 'fieldset',
00230 '#title' => t('Menu settings'),
00231 '#collapsible' => FALSE,
00232 '#tree' => TRUE,
00233 '#weight' => -2,
00234 '#attributes' => array('class' => 'menu-item-form'),
00235 '#item' => $item,
00236 );
00237 if ($type == 'add' || empty($item)) {
00238
00239 $item = array('link_title' => '', 'mlid' => 0, 'plid' => 0, 'menu_name' => $menu['menu_name'], 'weight' => 0, 'link_path' => '', 'options' => array(), 'module' => 'menu', 'expanded' => 0, 'hidden' => 0, 'has_children' => 0);
00240 }
00241 foreach (array('link_path', 'mlid', 'module', 'has_children', 'options') as $key) {
00242 $form['menu'][$key] = array('#type' => 'value', '#value' => $item[$key]);
00243 }
00244
00245 $form['menu']['customized'] = array('#type' => 'value', '#value' => 1);
00246 $form['menu']['original_item'] = array('#type' => 'value', '#value' => $item);
00247
00248 $path = span>];
00249 if (isset($item['options']['query'])) {
00250 $path .= '?' . $item['options']['query'];
00251 }
00252 if (isset($item['options']['fragment'])) {
00253 $path .= '#' . $item['options']['fragment'];
00254 }
00255 if ($item['module'] == 'menu') {
00256 $form['menu']['link_path'] = array(
00257 '#type' => 'textfield',
00258 '#title' => t('Path'),
00259 '#default_value' => $path,
00260 '#description' => t('The path this menu item links to. This can be an internal Drupal path such as %add-node or an external URL such as %drupal. Enter %front to link to the front page.', array('%front' => '<front>', '%add-node' => 'node/add', '%drupal' => 'http://drupal.org')),
00261 '#required' => TRUE,
00262 );
00263 $form['delete'] = array(
00264 '#type' => 'submit',
00265 '#value' => t('Delete'),
00266 '#access' => $item['mlid'],
00267 '#submit' => array('menu_item_delete_submit'),
00268 '#weight' => 10,
00269 );
00270 }
00271 else {
00272 $form['menu']['_path'] = array(
00273 '#type' => 'item',
00274 '#title' => t('Path'),
00275 '#description' => l($item['link_title'], $item['href'], $item['options']),
00276 );
00277 }
00278 $form['menu']['link_title'] = array('#type' => 'textfield',
00279 '#title' => t('Menu link title'),
00280 '#default_value' => $item['link_title'],
00281 '#description' => t('The link text corresponding to this item that should appear in the menu.'),
00282 '#required' => TRUE,
00283 );
00284 $form['menu']['description'] = array(
00285 '#type' => 'textarea',
00286 '#title' => t('Description'),
00287 '#default_value' => isset($item['options']['attributes']['title']) ? $item['options']['attributes']['title'] : '',
00288 '#rows' => 1,
00289 '#description' => t('The description displayed when hovering over a menu item.'),
00290 );
00291 $form['menu']['enabled'] = array(
00292 '#type' => 'checkbox',
00293 '#title' => t('Enabled'),
00294 '#default_value' => !$item['hidden'],
00295 '#description' => t('Menu items that are not enabled will not be listed in any menu.'),
00296 );
00297 $form['menu']['expanded'] = array(
00298 '#type' => 'checkbox',
00299 '#title' => t('Expanded'),
00300 '#default_value' => $item['expanded'],
00301 '#description' => t('If selected and this menu item has children, the menu will always appear expanded.'),
00302 );
00303
00304
00305 $options = menu_parent_options(menu_get_menus(), $item);
00306 $default = $item['menu_name'] . ':' . $item['plid'];
00307 if (!isset($options[$default])) {
00308 $default = 'navigation:0';
00309 }
00310 $form['menu']['parent'] = array(
00311 '#type' => 'select',
00312 '#title' => t('Parent item'),
00313 '#default_value' => $default,
00314 '#options' => $options,
00315 '#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)),
00316 '#attributes' => array('class' => 'menu-title-select'),
00317 );
00318 $form['menu']['weight'] = array(
00319 '#type' => 'weight',
00320 '#title' => t('Weight'),
00321 '#delta' => 50,
00322 '#default_value' => $item['weight'],
00323 '#description' => t('Optional. In the menu, the heavier items will sink and the lighter items will be positioned nearer the top.'),
00324 );
00325 $form['submit'] = array('#type' => 'submit', '#value' => t('Save'));
00326
00327
00328 return $form;
00329 }
00330
00334 function menu_edit_item_validate($form, &$form_state) {
00335 $item = &$form_state['values']['menu'];
00336 $normal_path = drupal_get_normal_path(span>]);
00337 if (span>] != $normal_path) {
00338 drupal_set_message(t('The menu system stores system paths only, but will use the URL alias for display. %link_path has been stored as %normal_path', array('%link_path' => span>], '%normal_path' => $normal_path)));
00339 span>] = $normal_path;
00340 }
00341 if (!menu_path_is_external(span>])) {
00342 $parsed_link = parse_url(span>]);
00343 if (isset($parsed_link['query'])) {
00344 $item['options']['query'] = $parsed_link['query'];
00345 }
00346 if (isset($parsed_link['fragment'])) {
00347 $item['options']['fragment'] = $parsed_link['fragment'];
00348 }
00349 if (span>] != $parsed_link['path']) {
00350 span>] = $parsed_link['path'];
00351 }
00352 }
00353 if (!trim(span>]) || !menu_valid_path($item)) {
00354 form_set_error('link_path', t("The path '@link_path' is either invalid or you do not have access to it.", array('@link_path' => span>])));
00355 }
00356 }
00357
00361 function menu_item_delete_submit($form, &$form_state) {
00362 $form_state['redirect'] = 'admin/build/menu/item/' . $form_state['values']['menu']['mlid'] . '/delete';
00363 }
00364
00368 function menu_edit_item_submit($form, &$form_state) {
00369 $item = $form_state['values']['menu'];
00370
00371
00372
00373 $item['hidden'] = (int) !$item['enabled'];
00374 unset($item['enabled']);
00375
00376 $item['options']['attributes']['title'] = $item['description'];
00377 list($item['menu_name'], $item['plid']) = explode(':', $item['parent']);
00378 if (!menu_link_save($item)) {
00379 drupal_set_message(t('There was an error saving the menu link.'), 'error');
00380 }
00381 $form_state['redirect'] = 'admin/build/menu-customize/' . $item['menu_name'];
00382 }
00383
00387 function menu_edit_menu(&$form_state, $type, $menu = array()) {
00388 if ($type == 'edit') {
00389 $form['menu_name'] = array('#type' => 'value', '#value' => $menu['menu_name']);
00390 $form['#insert'] = FALSE;
00391 $form['delete'] = array(
00392 '#type' => 'submit',
00393 '#value' => t('Delete'),
00394 '#access' => !in_array($menu['menu_name'], menu_list_system_menus()),
00395 '#submit' => array('menu_custom_delete_submit'),
00396 '#weight' => 10,
00397 );
00398 }
00399 else {
00400 $menu = array('menu_name' => '', 'title' => '', 'description' => '');
00401 $form['menu_name'] = array(
00402 '#type' => 'textfield',
00403 '#title' => t('Menu name'),
00404 '#maxsize' => MENU_MAX_MENU_NAME_LENGTH_UI,
00405 '#description' => t('The machine-readable name of this menu. This text will be used for constructing the URL of the <em>menu overview</em> page for this menu. This name must contain only lowercase letters, numbers, and hyphens, and must be unique.'),
00406 '#required' => TRUE,
00407 );
00408 $form['#insert'] = TRUE;
00409 }
00410 $form['#title'] = $menu['title'];
00411 $form['title'] = array(
00412 '#type' => 'textfield',
00413 '#title' => t('Title'),
00414 '#default_value' => $menu['title'],
00415 '#required' => TRUE,
00416 );
00417 $form['description'] = array(
00418 '#type' => 'textarea',
00419 '#title' => t('Description'),
00420 '#default_value' => $menu['description'],
00421 );
00422 $form['submit'] = array(
00423 '#type' => 'submit',
00424 '#value' => t('Save'),
00425 );
00426
00427 return $form;
00428 }
00429
00433 function menu_custom_delete_submit($form, &$form_state) {
00434 $form_state['redirect'] = 'admin/build/menu-customize/' . $form_state['values']['menu_name'] . '/delete';
00435 }
00436
00440 function menu_delete_menu_page($menu) {
00441
00442 if (in_array($menu['menu_name'], menu_list_system_menus())) {
00443 drupal_access_denied();
00444 return;
00445 }
00446 return drupal_get_form('menu_delete_menu_confirm', $menu);
00447 }
00448
00452 function menu_delete_menu_confirm(&$form_state, $menu) {
00453 $form['#menu'] = $menu;
00454 $caption = '';
00455 $num_links = db_result(db_query("SELECT COUNT(*) FROM {menu_links} WHERE menu_name = '%s'", $menu['menu_name']));
00456 if ($num_links) {
00457 $caption .= '<p>' . format_plural($num_links, '<strong>Warning:</strong> There is currently 1 menu item in %title. It will be deleted (system-defined items will be reset).', '<strong>Warning:</strong> There are currently @count menu items in %title. They will be deleted (system-defined items will be reset).', array('%title' => $menu['title'])) . '</p>';
00458 }
00459 $caption .= '<p>' . t('This action cannot be undone.') . '</p>';
00460 return confirm_form($form, t('Are you sure you want to delete the custom menu %title?', array('%title' => $menu['title'])), 'admin/build/menu-customize/' . $menu['menu_name'], $caption, t('Delete'));
00461 }
00462
00466 function menu_delete_menu_confirm_submit($form, &$form_state) {
00467 $menu = $form['#menu'];
00468 $form_state['redirect'] = 'admin/build/menu';
00469
00470 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']))) {
00471 return;
00472 }
00473
00474 $result = db_query("SELECT * FROM {menu_links} ml INNER JOIN {menu_router} m ON ml.router_path = m.path WHERE ml.menu_name = '%s' AND ml.module = 'system' ORDER BY m.number_parts ASC", $menu['menu_name']);
00475 while ($item = db_fetch_array($result)) {
00476 menu_reset_item($item);
00477 }
00478
00479 $result = db_query("SELECT mlid FROM {menu_links} ml WHERE ml.link_path = '%s'", 'admin/build/menu-customize/' . $menu['menu_name']);
00480 while ($m = db_fetch_array($result)) {
00481 menu_link_delete($m['mlid']);
00482 }
00483
00484 db_query("DELETE FROM {menu_links} WHERE menu_name = '%s'", $menu['menu_name']);
00485 db_query("DELETE FROM {menu_custom} WHERE menu_name = '%s'", $menu['menu_name']);
00486
00487 db_query("DELETE FROM {blocks} WHERE module = 'menu' AND delta = '%s'", $menu['menu_name']);
00488 db_query("DELETE FROM {blocks_roles} WHERE module = 'menu' AND delta = '%s'", $menu['menu_name']);
00489 menu_cache_clear_all();
00490 cache_clear_all();
00491 $t_args = array('%title' => $menu['title']);
00492 drupal_set_message(t('The custom menu %title has been deleted.', $t_args));
00493 watchdog('menu', 'Deleted custom menu %title and all its menu items.', $t_args, WATCHDOG_NOTICE);
00494 }
00495
00499 function menu_edit_menu_validate($form, &$form_state) {
00500 $item = $form_state['values'];
00501 if (preg_match('/[^a-z0-9-]/', $item['menu_name'])) {
00502 form_set_error('menu_name', t('The menu name may only consist of lowercase letters, numbers, and hyphens.'));
00503 }
00504 if (strlen($item['menu_name']) > MENU_MAX_MENU_NAME_LENGTH_UI) {
00505 form_set_error('menu_name', format_plural(MENU_MAX_MENU_NAME_LENGTH_UI, "The menu name can't be longer than 1 character.", "The menu name can't be longer than @count characters."));
00506 }
00507 if ($form['#insert']) {
00508
00509 $item['menu_name'] = 'menu-' . $item['menu_name'];
00510 if (db_result(db_query("SELECT menu_name FROM {menu_custom} WHERE menu_name = '%s'", $item['menu_name'])) ||
00511 db_result(db_query_range("SELECT menu_name FROM {menu_links} WHERE menu_name = '%s'", $item['menu_name'], 0, 1))) {
00512 form_set_error('menu_name', t('The menu already exists.'));
00513 }
00514 }
00515 }
00516
00520 function menu_edit_menu_submit($form, &$form_state) {
00521 $menu = $form_state['values'];
00522 $path = 'admin/build/menu-customize/';
00523 if ($form['#insert']) {
00524
00525 $menu['menu_name'] = 'menu-' . $menu['menu_name'];
00526 $link['link_title'] = $menu['title'];
00527 $link['link_path'] = $path . $menu['menu_name'];
00528 $link['router_path'] = $path . '%';
00529 $link['module'] = 'menu';
00530 $link['plid'] = db_result(db_query("SELECT mlid FROM {menu_links} WHERE link_path = '%s' AND module = '%s'", 'admin/build/menu', 'system'));
00531 menu_link_save($link);
00532 db_query("INSERT INTO {menu_custom} (menu_name, title, description) VALUES ('%s', '%s', '%s')", $menu['menu_name'], $menu['title'], $menu['description']);
00533 }
00534 else {
00535 db_query("UPDATE {menu_custom} SET title = '%s', description = '%s' WHERE menu_name = '%s'", $menu['title'], $menu['description'], $menu['menu_name']);
00536 $result = db_query("SELECT mlid FROM {menu_links} WHERE link_path = '%s'", $path . $menu['menu_name']);
00537 while ($m = db_fetch_array($result)) {
00538 $link = menu_link_load($m['mlid']);
00539 $link['link_title'] = $menu['title'];
00540 menu_link_save($link);
00541 }
00542 }
00543 $form_state['redirect'] = $path . $menu['menu_name'];
00544 }
00545
00549 function menu_item_delete_page($item) {
00550
00551
00552 if ($item['module'] == 'system' && !$item['updated']) {
00553 drupal_access_denied();
00554 return;
00555 }
00556 return drupal_get_form('menu_item_delete_form', $item);
00557 }
00558
00562 function menu_item_delete_form(&$form_state, $item) {
00563 $form['#item'] = $item;
00564 return confirm_form($form, t('Are you sure you want to delete the custom menu item %item?', array('%item' => $item['link_title'])), 'admin/build/menu-customize/' . $item['menu_name']);
00565 }
00566
00570 function menu_item_delete_form_submit($form, &$form_state) {
00571 $item = $form['#item'];
00572 menu_link_delete($item['mlid']);
00573 $t_args = array('%title' => $item['link_title']);
00574 drupal_set_message(t('The menu item %title has been deleted.', $t_args));
00575 watchdog('menu', 'Deleted menu item %title.', $t_args, WATCHDOG_NOTICE);
00576 $form_state['redirect'] = 'admin/build/menu-customize/' . $item['menu_name'];
00577 }
00578
00582 function menu_reset_item_confirm(&$form_state, $item) {
00583 $form['item'] = array('#type' => 'value', '#value' => $item);
00584 return confirm_form($form, t('Are you sure you want to reset the item %item to its default values?', array('%item' => $item['link_title'])), 'admin/build/menu-customize/' . $item['menu_name'], t('Any customizations will be lost. This action cannot be undone.'), t('Reset'));
00585 }
00586
00590 function menu_reset_item_confirm_submit($form, &$form_state) {
00591 $item = $form_state['values']['item'];
00592 $new_item = menu_reset_item($item);
00593 drupal_set_message(t('The menu item was reset to its default settings.'));
00594 $form_state['redirect'] = 'admin/build/menu-customize/' . $new_item['menu_name'];
00595 }
00596
00600 function menu_configure() {
00601 $form['intro'] = array(
00602 '#type' => 'item',
00603 '#value' => t('The menu module allows on-the-fly creation of menu links in the content authoring forms. The following option sets the default menu in which a new link will be added.'),
00604 );
00605
00606 $menu_options = menu_get_menus();
00607 $form['menu_default_node_menu'] = array(
00608 '#type' => 'select',
00609 '#title' => t('Default menu for content'),
00610 '#default_value' => variable_get('menu_default_node_menu', 'primary-links'),
00611 '#options' => $menu_options,
00612 '#description' => t('Choose the menu to be the default in the menu options in the content authoring form.'),
00613 );
00614
00615 $primary = variable_get('menu_primary_links_source', 'primary-links');
00616 $primary_options = array_merge($menu_options, array('' => t('No primary links')));
00617 $form['menu_primary_links_source'] = array(
00618 '#type' => 'select',
00619 '#title' => t('Source for the primary links'),
00620 '#default_value' => $primary,
00621 '#options' => $primary_options,
00622 '#tree' => FALSE,
00623 '#description' => t('Select what should be displayed as the primary links.'),
00624 );
00625
00626 $secondary_options = array_merge($menu_options, array('' => t('No secondary links')));
00627 $form["menu_secondary_links_source"] = array(
00628 '#type' => 'select',
00629 '#title' => t('Source for the secondary links'),
00630 '#default_value' => variable_get('menu_secondary_links_source', 'secondary-links'),
00631 '#options' => $secondary_options,
00632 '#tree' => FALSE,
00633 '#description' => t('Select what should be displayed as the secondary links. You can choose the same menu for secondary links as for primary links (currently %primary). If you do this, the children of the active primary menu link will be displayed as secondary links.', array('%primary' => $primary_options[$primary])),
00634 );
00635
00636 return system_settings_form($form);
00637 }
00638