Same name and namespace in other branches
  1. 4.7.x includes/menu.inc \menu_get_active_nontask_item()
  2. 5.x includes/menu.inc \menu_get_active_nontask_item()

Returns the ID of the current menu item or, if the current item is a local task, the menu item to which this task is attached.

Related topics

3 calls to menu_get_active_nontask_item()
menu_get_local_tasks in includes/menu.inc
Return the local task tree.
menu_primary_local_tasks in includes/menu.inc
Returns the rendered HTML of the primary local tasks.
menu_secondary_local_tasks in includes/menu.inc
Returns the rendered HTML of the secondary local tasks.

File

includes/menu.inc, line 406
API for the Drupal menu system.

Code

function menu_get_active_nontask_item() {
  $menu = menu_get_menu();
  $mid = menu_get_active_item();

  // Find the first non-task item:
  while ($mid && $menu['items'][$mid]['type'] & MENU_IS_LOCAL_TASK) {
    $mid = $menu['items'][$mid]['pid'];
  }
  if ($mid) {
    return $mid;
  }
}