You are here

function hook_local_tasks_alter in Drupal 10

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Menu/menu.api.php \hook_local_tasks_alter()
  2. 9 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

Related topics

5 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().
views_local_tasks_alter in core/modules/views/views.module
Implements hook_local_tasks_alter().
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
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']);
}