8.5.x menu.inc menu_local_tasks($level = 0)
8.0.x menu.inc menu_local_tasks($level = 0)
8.1.x menu.inc menu_local_tasks($level = 0)
8.2.x menu.inc menu_local_tasks($level = 0)
8.3.x menu.inc menu_local_tasks($level = 0)
8.4.x menu.inc menu_local_tasks($level = 0)
8.6.x menu.inc menu_local_tasks($level = 0)
6.x menu.inc menu_local_tasks($level = 0, $return_root = FALSE)
7.x menu.inc menu_local_tasks($level = 0)

Collects the local tasks (tabs) for the current route.

Parameters

int $level: The level of tasks you ask for. Primary tasks are 0, secondary are 1.

Return value

array An array containing

  • tabs: Local tasks for the requested level.
  • route_name: The route name for the current page used to collect the local tasks.

Deprecated

in Drupal 8.0.0, will be removed before Drupal 9.0.0.

See also

hook_menu_local_tasks_alter()

https://www.drupal.org/node/2544940

Related topics

1 string reference to 'menu_local_tasks'
LocalTaskManager::getLocalTasks in core/lib/Drupal/Core/Menu/LocalTaskManager.php
Renders the local tasks (tabs) for the given route.

File

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

Code

function menu_local_tasks($level = 0) {

  /** @var \Drupal\Core\Menu\LocalTaskManagerInterface $manager */
  $manager = \Drupal::service('plugin.manager.menu.local_task');
  return $manager
    ->getLocalTasks(\Drupal::routeMatch()
    ->getRouteName(), $level);
}