W3cubDocs

/Drupal 8

function hook_local_tasks_alter

hook_local_tasks_alter(&$local_tasks)

Alter local tasks plugins.

Parameters

array $local_tasks: The array of local tasks plugin definitions, keyed by plugin ID.

See also

\Drupal\Core\Menu\LocalTaskInterface

\Drupal\Core\Menu\LocalTaskManager

Related topics

Hooks
Define functions that alter the behavior of Drupal core.
Menu system
Define the navigation menus, local actions and tasks, and contextual links.

File

core/lib/Drupal/Core/Menu/menu.api.php, line 349
Hooks and documentation related to the menu system and links.

Code

function hook_local_tasks_alter(&$local_tasks) {
  // Remove a specified local task plugin.
  unset($local_tasks['example_plugin_id']);
}

© 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_local_tasks_alter/8.1.x