function menu_primary_local_tasks
Same name in other branches
- 7.x includes/menu.inc \menu_primary_local_tasks()
Returns the rendered local tasks at the top level.
Deprecated
in drupal:8.0.0 and is removed from drupal:9.0.0. Use \Drupal\Core\Menu\LocalTaskManagerInterface::getLocalTasks() instead.
See also
https://www.drupal.org/node/2874695
Related topics
2 calls to menu_primary_local_tasks()
- MenuLegacyTest::testPrimaryLocalTasks in core/
tests/ Drupal/ KernelTests/ Core/ Menu/ MenuLegacyTest.php - Tests deprecation of the menu_primary_local_tasks() function.
- menu_local_tabs in core/
includes/ menu.inc - Returns a renderable element for the primary and secondary tabs.
File
-
core/
includes/ menu.inc, line 125
Code
function menu_primary_local_tasks() {
@trigger_error(__FUNCTION__ . '() is deprecated in drupal:8.0.0 and is removed from drupal:9.0.0. Use \\Drupal\\Core\\Menu\\LocalTaskManagerInterface::getLocalTasks() instead. See https://www.drupal.org/node/2874695', E_USER_DEPRECATED);
/** @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'] : '';
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.