<?php
function menu_help($section) {
switch ($section) {
case 'admin/help#menu':
$output = t('<p>Menus are a collection of links (menu items) used to navigate a website. The menu module provides an interface to control and customize the powerful menu system that comes with Drupal. Menus are primarily displayed as a hierarchical list of links using Drupal\'s highly flexible <a href="@admin-block">blocks</a> feature. Each menu automatically creates a block of the same name. By default, new menu items are placed inside a built-in menu labelled %navigation, but administrators can also create custom menus.</p>
<p>Drupal themes generally provide out-of-the-box support for two menus commonly labelled %primary-links and %secondary-links. These are sets of links which are usually displayed in the header or footer of each page (depending on the currently active theme). Any menu can be designated as the primary or secondary links menu via the <a href="@menu-settings">menu settings page</a>.</p>
Menu administration tabs:
<ul>
<li>On the administer menu page, administrators can "edit" to change the title, description, parent or weight of a menu item. Under the "operations" column, click on "enable/disable" to toggle a menu item on or off. Only menu items which are enabled are displayed in the corresponding menu block. Note that the default menu items generated by the menu module cannot be deleted, only disabled.</li>
<li>Use the "add menu" tab to submit a title for a new custom menu. Once submitted, the menu will appear in a list toward the bottom of the administer menu page underneath the main navigation menu. Under the menu name there will be links to edit or delete the menu, and a link to add new items to the menu.</li>
<li>Use the "add menu item" tab to create new links in either the navigation or a custom menu (such as a primary/secondary links menu). Select the parent item to place the new link within an existing menu structure. For top level menu items, choose the name of the menu in which the link is to be added.</li>
</ul>', array('%navigation' => 'Navigation', '%primary-links' => 'primary links', '%secondary-links' => 'secondary links', '@admin-block' => url('admin/build/block'), '@menu-settings' => url('admin/build/menu/settings')));
$output .= '<p>'. t('For more information please read the configuration and customization handbook <a href="@menu">Menu page</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 list(s) below display the currently available menus along with their menu items. Select an operation from the list to manage each menu or menu item.', array('@admin-settings-menus' => url('admin/build/menu/settings'), '@admin-block'=> url('admin/build/block'))) .'</p>';
case 'admin/build/menu/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/item/add':
return '<p>'. t('Enter the title, path, position and the weight for your new menu item.') .'</p>';
}
}
function menu_menu($may_cache) {
$items = array();
if ($may_cache) {
$items[] = array('path' => 'admin/build/menu',
'title' => t('Menus'),
'description' => t("Control your site's navigation menu, primary links and secondary links. as well as rename and reorganize menu items."),
'callback' => 'menu_overview',
'access' => user_access('administer menu'));
$items[] = array('path' => 'admin/build/menu/list',
'title' => t('List'),
'type' => MENU_DEFAULT_LOCAL_TASK,
'weight' => -10);
$items[] = array('path' => 'admin/build/menu/item/add',
'title' => t('Add menu item'),
'callback' => 'drupal_get_form',
'callback arguments' => array('menu_edit_item_form', 'add'),
'access' => user_access('administer menu'),
'type' => MENU_LOCAL_TASK);
$items[] = array('path' => 'admin/build/menu/item/edit',
'title' => t('Edit menu item'),
'callback' => 'drupal_get_form',
'callback arguments' => array('menu_edit_item_form', 'edit'),
'access' => user_access('administer menu'),
'type' => MENU_CALLBACK);
$items[] = array('path' => 'admin/build/menu/item/reset',
'title' => t('Reset menu item'),
'callback' => 'drupal_get_form',
'callback arguments' => array('menu_reset_item'),
'access' => user_access('administer menu'),
'type' => MENU_CALLBACK);
$items[] = array('path' => 'admin/build/menu/item/disable',
'title' => t('Disable menu item'),
'callback' => 'drupal_get_form',
'callback arguments' => array('menu_confirm_disable_item'),
'access' => user_access('administer menu'),
'type' => MENU_CALLBACK);
$items[] = array('path' => 'admin/build/menu/item/delete',
'title' => t('Delete menu item'),
'callback' => 'drupal_get_form',
'callback arguments' => array('menu_item_delete_form'),
'access' => user_access('administer menu'),
'type' => MENU_CALLBACK);
$items[] = array('path' => 'admin/build/menu/menu/add',
'title' => t('Add menu'),
'callback' => 'drupal_get_form',
'callback arguments' => array('menu_edit_menu_form', 'add'),
'access' => user_access('administer menu'),
'type' => MENU_LOCAL_TASK);
$items[] = array('path' => 'admin/build/menu/menu/edit',
'title' => t('Edit menu'),
'callback' => 'drupal_get_form',
'callback arguments' => array('menu_edit_menu_form', 'edit'),
'access' => user_access('administer menu'),
'type' => MENU_CALLBACK);
$items[] = array('path' => 'admin/build/menu/menu/delete',
'title' => t('Delete menu'),
'callback' => 'drupal_get_form',
'callback arguments' => array('menu_item_delete_form'),
'access' => user_access('administer menu'),
'type' => MENU_CALLBACK);
$items[] = array('path' => 'admin/build/menu/settings',
'title' => t('Settings'),
'callback' => 'drupal_get_form',
'callback arguments' => array('menu_configure'),
'type' => MENU_LOCAL_TASK,
'weight' => 5,
);
}
return $items;
}
function menu_block($op = 'list', $delta = 0) {
if ($op == 'list') {
$blocks = array();
$root_menus = menu_get_root_menus();
foreach ($root_menus as $mid => $title) {
if ($mid != 1) {
$blocks[$mid]['info'] = $title;
}
}
return $blocks;
}
else if ($op == 'view') {
$item = menu_get_item($delta);
$data['subject'] = check_plain($item['title']);
$data['content'] = theme('menu_tree', $delta);
return $data;
}
}
function menu_nodeapi(&$node, $op) {
if (user_access('administer menu')) {
switch ($op) {
case 'insert':
case 'update':
if ($node->menu['delete']) {
menu_node_form_delete($node);
menu_rebuild();
}
elseif ($node->menu['title']) {
$node->menu['path'] = ($node->menu['path']) ? $node->menu['path'] : "node/$node->nid";
menu_edit_item_save($node->menu);
menu_rebuild();
}
break;
case 'delete':
menu_node_form_delete($node);
menu_rebuild();
break;
}
}
}
function menu_perm() {
return array('administer menu');
}
function menu_form_alter($form_id, &$form) {
if (isset($form['type']) && $form['type']['#value'] .'_node_form' == $form_id) {
$item = array();
if ($form['nid']['#value'] > 0) {
$item = db_fetch_array(db_query("SELECT * FROM {menu} WHERE path = 'node/%d' ORDER BY mid", $form['nid']['#value']));
if (isset($form['#post']['menu']) && is_array($form['#post']['menu'])) {
$item = !is_array($item) ? $form['#post']['menu'] : (($form['#post']['op'] == t('Preview')) ? array_merge($item, $form['#post']['menu']) : array_merge($form['#post']['menu'], $item));
}
}
$form['menu'] = array('#type' => 'fieldset',
'#title' => t('Menu settings'),
'#access' => user_access('administer menu'),
'#collapsible' => TRUE,
'#collapsed' => empty($item['title']),
'#tree' => TRUE,
'#weight' => 30,
);
$form['menu']['title'] = array('#type' => 'textfield',
'#title' => t('Title'),
'#default_value' => $item['title'],
'#description' => t('The name to display for this menu link.'),
);
$form['menu']['description'] = array('#type' => 'textfield',
'#title' => t('Description'),
'#default_value' => $item['description'],
'#description' => t('The description displayed when hovering over a menu item.'),
);
$options = menu_parent_options($item['mid'], variable_get('menu_parent_items', 0));
$form['menu']['pid'] = array('#type' => 'select',
'#title' => t('Parent item'),
'#default_value' => $item['pid'],
'#options' => $options,
);
$form['menu']['path'] = array('#type' => 'hidden',
'#value' => $item['path'],
);
$form['menu']['weight'] = array('#type' => 'weight',
'#title' => t('Weight'),
'#default_value' => $item['weight'],
'#delta' => 10,
'#description' => t('Optional. In the menu, the heavier items will sink and the lighter items will be positioned nearer the top.'),
);
$form['menu']['mid'] = array('#type' => 'hidden',
'#value' => $item['mid'] ? $item['mid'] : 0,
);
$form['menu']['type'] = array('#type' => 'hidden',
'#value' => $item['type'] ? $item['type'] : MENU_CUSTOM_ITEM,
);
if ($item['mid'] > 0) {
$form['menu']['delete'] = array('#type' => 'checkbox',
'#title' => t('Check to delete this menu item.'),
'#default_value' => $item['delete'],
);
$form['menu']['advanced'] = array('#type' => 'item',
'#value' => t('You may also <a href="@edit">edit the advanced settings</a> for this menu item.', array('@edit' => url("admin/build/menu/item/edit/{$item['mid']}"))),
);
}
}
}
function menu_configure() {
$root_menus = menu_get_root_menus();
$primary_options = $root_menus;
$primary_options[0] = t('No primary links');
$form['settings_links'] = array('#type' => 'fieldset',
'#title' => t('Primary and secondary links settings'),
);
$form['settings_links']['intro'] = array('#type' => 'item',
'#value' => t('Primary and secondary links provide a navigational menu system which usually (depending on your theme) appears at the top-right of the browser window. The links displayed can be generated either from a custom list created via the <a href="@menu">menu administration</a> page or from a built-in list of menu items such as the navigation menu links.', array('@menu' => url('admin/build/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 = $root_menus;
$secondary_options[0] = t('No secondary links');
$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.'),
);
$form['settings_authoring'] = array('#type' => 'fieldset',
'#title' => t('Content authoring form settings'),
);
$form['settings_authoring']['intro'] = array('#type' => 'item',
'#value' => t('The menu module allows on-the-fly creation of menu links in the content authoring forms. The following option limits the menus in which a new link may be added. E.g., this can be used to force new menu items to be created in the primary links menu or to hide admin menu items.'),
);
$authoring_options = $root_menus;
$authoring_options[0] = t('Show all menus');
$form['settings_authoring']['menu_parent_items'] = array('#type' => 'select',
'#title' => t('Restrict parent items to'),
'#default_value' => variable_get('menu_parent_items', 0),
'#options' => $authoring_options,
'#description' => t('Choose the menu to be made available in the content authoring form. Only this menu item and its children will be shown.'),
);
return system_settings_form($form);
}
function menu_edit_menu_form($type, $mid = 0) {
if ($type == 'edit') {
if (!($item = db_fetch_array(db_query('SELECT * FROM {menu} WHERE mid = %d', $mid)))) {
drupal_not_found();
return;
}
}
else {
$item = array('mid' => 0, 'pid' => 0, 'path' => '', 'weight' => 0, 'type' => MENU_CUSTOM_MENU);
}
$form['title'] = array('#type' => 'textfield',
'#title' => t('Title'),
'#default_value' => $item['title'],
'#description' => t('The name of the menu.'),
'#required' => TRUE,
);
$form['mid'] = array('#type' => 'value', '#value' => $item['mid']);
$form['pid'] = array('#type' => 'value', '#value' => $item['pid']);
$form['path'] = array('#type' => 'value', '#value' => $item['path']);
$form['weight'] = array('#type' => 'value', '#value' => $item['weight']);
$form['type'] = array('#type' => 'value', '#value' => $item['type']);
$form['submit'] = array('#type' => 'submit', '#value' => t('Submit'));
$form['#base'] = 'menu_edit_item_form';
return $form;
}
function menu_edit_item_form($type, $mid = 0) {
if ($type == 'edit') {
if (!($item = db_fetch_array(db_query('SELECT * FROM {menu} WHERE mid = %d', $mid)))) {
drupal_not_found();
return;
}
}
else {
$default_pid = $mid ? $mid : 1;
$item = array('mid' => 0, 'pid' => $default_pid, 'weight' => 0, 'type' => MENU_CUSTOM_ITEM);
}
$form['title'] = array('#type' => 'textfield',
'#title' => t('Title'),
'#default_value' => $item['title'],
'#description' => t('The name of the menu item.'),
'#required' => TRUE,
);
$form['description'] = array('#type' => 'textfield',
'#title' => t('Description'),
'#default_value' => $item['description'],
'#description' => t('The description displayed when hovering over a menu item.'),
'#maxlength' => 255,
);
if ($item['type'] & MENU_CREATED_BY_ADMIN) {
$form['path'] = array('#type' => 'textfield',
'#title' => t('Path'),
'#default_value' => $item['path'],
'#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')),
'#required' => TRUE,
);
}
else {
$form['_path'] = array('#type' => 'item',
'#title' => t('Path'),
'#description' => l($item['path'], $item['path']),
);
$form['path'] = array('#type' => 'value', '#value' => $item['path']);
}
$expanded = $item['type'] & MENU_EXPANDED ? 1 : 0;
$form['expanded'] = array('#type' => 'checkbox',
'#title' => t('Expanded'),
'#default_value' => $expanded,
'#description' => t('If selected and this menu item has children, the menu will always appear expanded.'),
);
$options = menu_parent_options($item['mid']);
$form['pid'] = array('#type' => 'select',
'#title' => t('Parent item'),
'#default_value' => $item['pid'],
'#options' => $options,
);
$form['weight'] = array('#type' => 'weight',
'#title' => t('Weight'),
'#default_value' => $item['weight'],
'#description' => t('Optional. In the menu, the heavier items will sink and the lighter items will be positioned nearer the top.'),
);
if (!($item['type'] & (MENU_IS_ROOT | MENU_VISIBLE_IF_HAS_CHILDREN))) {
$item['type'] |= MENU_VISIBLE_IN_TREE | MENU_VISIBLE_IN_BREADCRUMB;
}
$form['type'] = array('#type' => 'value', '#value' => $item['type']);
$form['mid'] = array('#type' => 'value', '#value' => $item['mid']);
$form['submit'] = array('#type' => 'submit', '#value' => t('Submit'));
return $form;
}
function menu_edit_item_form_submit($form_id, $form_values) {
menu_edit_item_save($form_values);
return 'admin/build/menu';
}
function menu_item_delete_form($mid) {
if (!($menu = db_fetch_object(db_query('SELECT type, title FROM {menu} WHERE mid = %d', $mid)))) {
drupal_not_found();
return;
}
$form['mid'] = array('#type' => 'value', '#value' => $mid);
$form['type'] = array('#type' => 'value', '#value' => $menu->type);
$form['title'] = array('#type' => 'value', '#value' => $menu->title);
if ($menu->type & MENU_IS_ROOT) {
$message = t('Are you sure you want to delete the menu %item?', array('%item' => $menu->title));
}
else {
$message = t('Are you sure you want to delete the custom menu item %item?', array('%item' => $menu->title));
}
return confirm_form($form, $message, 'admin/build/menu', t('This action cannot be undone.'), t('Delete'));
}
function menu_item_delete_form_submit($form_id, $form_values) {
menu_delete_item($form_values['mid']);
$t_args = array('%title' => $form_values['title']);
if ($form_values['type'] & MENU_IS_ROOT) {
drupal_set_message(t('The menu %title has been deleted.', $t_args));
watchdog('menu', t('Deleted menu %title.', $t_args), WATCHDOG_NOTICE);
}
else {
drupal_set_message(t('The menu item %title has been deleted.', $t_args));
watchdog('menu', t('Deleted menu item %title.', $t_args), WATCHDOG_NOTICE);
}
return 'admin/build/menu';
}
function menu_reset_item($mid) {
if (isset($mid) && $title = db_result(db_query('SELECT title FROM {menu} WHERE mid = %d', $mid))) {
$form['mid'] = array('#type' => 'value', '#value' => $mid);
return confirm_form($form, t('Are you sure you want to reset the item %item to its default values?', array('%item' => $title)), 'admin/build/menu', t('Any customizations will be lost. This action cannot be undone.'), t('Reset'));
}
else {
drupal_not_found();
}
}
function menu_reset_item_submit($form_id, $form_values) {
menu_delete_item($form_values['mid']);
drupal_set_message(t('The menu item was reset to its default settings.'));
return 'admin/build/menu';
}
function menu_confirm_disable_item($mid, $token = NULL) {
global $user;
$item = menu_get_item($mid);
$form = array();
$form['mid'] = array('#type' => 'value', '#value' => $mid);
$form['item'] = array('#type' => 'value', '#value' => $item);
return confirm_form($form, t('Are you sure you want to disable the menu item %menu-item?', array('%menu-item' => $item['title'])), 'admin/build/menu', ' ', t('Disable'), t('Cancel'));
}
function menu_confirm_disable_item_submit($form_id, $form_values) {
$type = $form_values['item']['type'];
$type &= ~MENU_VISIBLE_IN_TREE;
$type &= ~MENU_VISIBLE_IN_BREADCRUMB;
$type |= MENU_MODIFIED_BY_ADMIN;
db_query('UPDATE {menu} SET type = %d WHERE mid = %d', $type, $form_values['mid']);
drupal_set_message(t('The menu item has been disabled.'));
drupal_goto('admin/build/menu');
}
function menu_overview() {
menu_rebuild();
return menu_overview_tree();
}
function menu_edit_item_save($edit) {
if (isset($edit['expanded'])) {
if ($edit['expanded']) {
$edit['type'] |= MENU_EXPANDED;
}
else {
$edit['type'] &= ~MENU_EXPANDED;
}
}
$edit['type'] = $edit['type'] | MENU_MODIFIED_BY_ADMIN;
$status = menu_save_item($edit);
$t_args = array('%title' => $edit['title']);
if ($status == SAVED_UPDATED) {
drupal_set_message(t('The menu item %title has been updated.', $t_args));
}
elseif ($status == SAVED_NEW) {
drupal_set_message(t('The menu item %title has been added.', $t_args));
watchdog('menu', t('Added menu item %title.', $t_args), WATCHDOG_NOTICE, l(t('view'), 'admin/build/menu'));
}
return $edit['mid'];
}
function menu_save_item(&$item) {
$existing_item = NULL;
if (isset($item['mid'])) {
$existing_item = menu_get_item($item['mid']);
}
if ($item['mid'] && !empty($existing_item)) {
db_query("UPDATE {menu} SET pid = %d, path = '%s', title = '%s', description = '%s', weight = %d, type = %d WHERE mid = %d", $item['pid'], $item['path'], $item['title'], $item['description'], $item['weight'], $item['type'], $item['mid']);
return SAVED_UPDATED;
}
else {
$item['mid'] = db_next_id('{menu}_mid');
while ($item['mid'] <= 2) {
$item['mid'] = db_next_id('{menu}_mid');
}
db_query("INSERT INTO {menu} (mid, pid, path, title, description, weight, type) VALUES (%d, %d, '%s', '%s', '%s', %d, %d)", $item['mid'], $item['pid'], $item['path'], $item['title'], $item['description'], $item['weight'], $item['type']);
return SAVED_NEW;
}
}
function menu_delete_item($item) {
if (!is_array($item)) {
$item = array('mid' => $item);
}
if ($item['mid']) {
db_query('DELETE FROM {menu} WHERE mid = %d', $item['mid']);
}
elseif ($item['path']) {
db_query("DELETE FROM {menu} WHERE path = '%s'", $item['path']);
}
}
function menu_overview_tree() {
$menu = menu_get_menu();
$root_menus = menu_get_root_menus();
$header = array(t('Menu item'), t('Expanded'), array('data' => t('Operations'), 'colspan' => '3'));
$output = '';
foreach (array_reverse($root_menus, true) as $mid => $title) {
$operations = array();
if ($menu['items'][$mid]['type'] & MENU_MODIFIABLE_BY_ADMIN) {
$operations[] = l(t('Edit'), 'admin/build/menu/menu/edit/'. $mid);
}
if ($menu['items'][$mid]['type'] & MENU_CREATED_BY_ADMIN) {
$operations[] = l(t('Delete'), 'admin/build/menu/menu/delete/'. $mid);
}
$operations[] = l(t('Add item'), 'admin/build/menu/item/add/'. $mid);
$table = theme('item_list', $operations);
$rows = menu_overview_tree_rows($mid);
$table .= theme('table', $header, $rows ? $rows : array(array(array('data' => t('No menu items defined.'), 'colspan' => 5))));
$output .= theme('box', check_plain($title), $table);
}
return $output;
}
function menu_overview_tree_rows($pid = 0, $depth = 0) {
$parent_item = menu_get_item($pid);
$rows = array();
if (isset($parent_item) && isset($parent_item['children'])) {
usort($parent_item['children'], '_menu_sort');
foreach ($parent_item['children'] as $mid) {
$item = menu_get_item($mid);
$title = '';
if ($pid == 0) {
$title .= check_plain($item['title']);
}
else {
$title .= l($item['title'], $item['path']);
}
if ($depth > 0) {
$title = '- '. $title;
}
for ($i = 1; $i < $depth; $i++) {
$title = ' '. $title;
}
$operations = array();
if (!($item['type'] & MENU_MODIFIABLE_BY_ADMIN)) {
$operations[] = array('data' => t('locked'), 'colspan' => '3', 'align' => 'center');
}
else {
if ($item['type'] & (MENU_VISIBLE_IN_TREE | MENU_VISIBLE_IF_HAS_CHILDREN)) {
$operations[] = array('data' => l(t('edit'), 'admin/build/menu/item/edit/'. $mid));
}
else {
$operations[] = array('data' => '');
}
if ($item['type'] & (MENU_IS_ROOT | MENU_VISIBLE_IF_HAS_CHILDREN)) {
$operations[] = array('data' => '');
}
else if ($item['type'] & MENU_VISIBLE_IN_TREE) {
$operations[] = array('data' => l(t('disable'), 'admin/build/menu/item/disable/'. $mid));
}
else {
$operations[] = array('data' => l(t('enable'), 'admin/build/menu/item/edit/'. $mid));
}
if ($item['type'] & MENU_CREATED_BY_ADMIN) {
$operations[] = array('data' => l(t('delete'), 'admin/build/menu/item/delete/'. $mid));
}
else if ($item['type'] & MENU_MODIFIED_BY_ADMIN) {
$operations[] = array('data' => l(t('reset'), 'admin/build/menu/item/reset/'. $mid));
}
else {
$operations[] = array('data' => '');
}
}
if ($item['type'] & (MENU_VISIBLE_IN_TREE | MENU_VISIBLE_IF_HAS_CHILDREN)) {
$class = 'menu-enabled';
}
else {
$title .= ' ('. t('disabled') .')';
$class = 'menu-disabled';
}
if ($item['type'] & (MENU_MODIFIABLE_BY_ADMIN | MENU_VISIBLE_IN_TREE)) {
$row = array(array('data' => $title, 'class' => $class), array('data' => ($item['children'] ? (($item['type'] & MENU_EXPANDED) ? t('Yes') : t('No')) : ''), 'class' => $class));
foreach ($operations as $operation) {
$operation['class'] = $class;
$row[] = $operation;
}
$rows[] = $row;
$rows = array_merge($rows, menu_overview_tree_rows($mid, $depth + 1));
}
else {
$rows = array_merge($rows, menu_overview_tree_rows($mid, $depth));
}
}
}
return $rows;
}
function menu_parent_options($mid, $pid = 0, $depth = 0) {
$options = array();
if (!($parent_item = menu_get_item($pid))) {
return $options;
}
if ($mid && $mid == $pid) {
return $options;
}
if ($pid > 0 && ($parent_item['type'] & (MENU_MODIFIABLE_BY_ADMIN | MENU_IS_ROOT))) {
$title = ' '. $parent_item['title'];
for ($i = 0; $i < $depth; $i++) {
$title = '--'. $title;
}
if (!($parent_item['type'] & MENU_VISIBLE_IN_TREE)) {
$title .= ' ('. t('disabled') .')';
}
$options[$pid] = $title;
$depth ++;
}
if (isset($parent_item['children'])) {
usort($parent_item['children'], '_menu_sort');
foreach ($parent_item['children'] as $child) {
$options += menu_parent_options($mid, $child, $depth);
}
}
return $options;
}
function menu_node_form_delete($node) {
menu_delete_item(array('path' => 'node/'. $node->nid));
}