menu_get_local_tasks

  1. drupal
    1. 4.7
    2. 5
Versions
4.7 – 5 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 functions call 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.

Code

includes/menu.inc, line 237

<?php
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'];
}
?>