function menu_local_tasks in Drupal 8
Same name and namespace in other branches
- 6 includes/menu.inc \menu_local_tasks()
- 7 includes/menu.inc \menu_local_tasks()
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 and is removed from drupal:9.0.0.
See also
https://www.drupal.org/node/2544940
Related topics
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);
}