function menu_primary_local_tasks in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/includes/menu.inc \menu_primary_local_tasks()
Returns the rendered local tasks at the top level.
Related topics
1 call to menu_primary_local_tasks()
- menu_local_tabs in core/
includes/ menu.inc - Returns a renderable element for the primary and secondary tabs.
File
- core/
includes/ menu.inc, line 122 - API for the Drupal menu system.
Code
function menu_primary_local_tasks() {
/** @var \Drupal\Core\Menu\LocalTaskManagerInterface $manager */
$manager = \Drupal::service('plugin.manager.menu.local_task');
$links = $manager
->getLocalTasks(\Drupal::routeMatch()
->getRouteName(), 0);
// Do not display single tabs.
return count(Element::getVisibleChildren($links['tabs'])) > 1 ? $links['tabs'] : '';
}