menu_disable_item

Versions
4.6
menu_disable_item($mid)
4.7
menu_disable_item($mid, $token = NULL)

Menu callback; hide a menu item.

Code

modules/menu.module, line 213

<?php
function menu_disable_item($mid) {
  $op = $_POST['op'];  
  $menu = menu_get_menu();  
  switch ($op) {
    case t('Disable'):
      $type = $menu['items'][$mid]['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, $mid);
      drupal_set_message(t('Menu item disabled.'));
      drupal_goto('admin/menu');  
      break;
    default:      
      $output = theme('confirm',
                      t('Are you sure you want disable %menu-item?', array('%menu-item' => theme('placeholder', $menu['items'][$mid]['title']))),
                      'admin/menu',
                      ' ',
                      t('Disable'));
      print theme('page', $output);
  }
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.