menu_get_active_nontask_item

Definition

menu_get_active_nontask_item()
includes/menu.inc, line 472

Description

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

Namesort iconDescription
Menu systemDefine the navigation menus, and route page requests to code based on URLs.

Code

<?php
function menu_get_active_nontask_item() {
  $mid = menu_get_active_item();

  // Find the first non-task item:
  while ($mid) {
    $item = menu_get_item($mid);

    if (!($item['type'] & MENU_IS_LOCAL_TASK)) {
      return $mid;
    }

    $mid = $item['pid'];
  }
}
?>
 
 

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.