function hook_local_tasks_alter

Same name in other branches
  1. 9 core/lib/Drupal/Core/Menu/menu.api.php \hook_local_tasks_alter()
  2. 8.9.x core/lib/Drupal/Core/Menu/menu.api.php \hook_local_tasks_alter()
  3. 11.x core/lib/Drupal/Core/Menu/menu.api.php \hook_local_tasks_alter()

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

hook_menu_local_tasks_alter()

Related topics

7 functions implement hook_local_tasks_alter()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

contact_menu_local_tasks_alter in core/modules/contact/contact.module
Implements hook_menu_local_tasks_alter().
field_ui_local_tasks_alter in core/modules/field_ui/field_ui.module
Implements hook_local_tasks_alter().
media_library_local_tasks_alter in core/modules/media_library/media_library.module
Implements hook_local_tasks_alter().
menu_test_menu_local_tasks_alter in core/modules/system/tests/modules/menu_test/menu_test.module
Implements hook_menu_local_tasks_alter().
node_local_tasks_alter in core/modules/node/node.module
Implements hook_local_tasks_alter().

... See full list

1 invocation of hook_local_tasks_alter()
LocalTaskManager::__construct in core/lib/Drupal/Core/Menu/LocalTaskManager.php
Constructs a \Drupal\Core\Menu\LocalTaskManager object.

File

core/lib/Drupal/Core/Menu/menu.api.php, line 360

Code

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

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.