hook_menu_local_tasks_alter(&$data,$route_name)
Alter local tasks displayed on the page before they are rendered.
This hook is invoked by menu_local_tasks(). The system-determined tabs and actions are passed in by reference. Additional tabs may be added.
The local tasks are under the 'tabs' element and keyed by plugin ID.
Each local task is an associative array containing:
array $data: An associative array containing list of (up to 2) tab levels that contain a list of tabs keyed by their href, each one being an associative array as described above.
string $route_name: The route name of the page.
function hook_menu_local_tasks_alter(&$data, $route_name) { // Add a tab linking to node/add to all pages. $data['tabs'][0]['node.add_page'] = array( '#theme' => 'menu_local_task', '#link' => array( 'title' => t('Example tab'), 'url' => Url::fromRoute('node.add_page'), 'localized_options' => array( 'attributes' => array( 'title' => t('Add content'), ), ), ), ); }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Menu!menu.api.php/function/hook_menu_local_tasks_alter/8.1.x