You are here

function menu_get_local_tasks in Drupal 5

Same name and namespace in other branches
  1. 4 includes/menu.inc \menu_get_local_tasks()

Return the local task tree.

Unlike the rest of the menu structure, the local task tree cannot be cached nor determined too early in the page request, because the user's current location may be changed by a menu_set_location() call, and the tasks shown (just as the breadcrumb trail) need to reflect the changed location.

Related topics

2 calls to menu_get_local_tasks()
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 236
API for the Drupal menu system.

Code

function menu_get_local_tasks() {
  global $_menu;

  // Don't cache the local task tree, as it varies by location and tasks are
  // allowed to be dynamically determined.
  if (!isset($_menu['local tasks'])) {

    // _menu_build_local_tasks() may indirectly call this function, so prevent
    // infinite loops.
    $_menu['local tasks'] = array();
    $pid = menu_get_active_nontask_item();
    if (!_menu_build_local_tasks($pid)) {

      // If the build returned FALSE, the tasks need not be displayed.
      $_menu['local tasks'][$pid]['children'] = array();
    }
  }
  return $_menu['local tasks'];
}