menu_primary_local_tasks()
Returns the rendered local tasks at the top level.
Related topics
- Menu system
- Define the navigation menus, local actions and tasks, and contextual links.
File
- core/includes/menu.inc, line 122
- API for the Drupal menu system.
Code
1 2 3 4 5 6 7 | 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' ] : '' ; } |
Please login to continue.