function hook_contextual_links_plugins_alter

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

Alter the plugin definition of contextual links.

Parameters

array $contextual_links: An array of contextual_links plugin definitions, keyed by contextual link ID. Each entry contains the following keys:

  • title: The displayed title of the link
  • route_name: The route_name of the contextual link to be displayed
  • group: The group under which the contextual links should be added to. Possible values are e.g. 'node' or 'menu'.

See also

\Drupal\Core\Menu\ContextualLinkManager

Related topics

1 invocation of hook_contextual_links_plugins_alter()
ContextualLinkManager::__construct in core/lib/Drupal/Core/Menu/ContextualLinkManager.php
Constructs a new ContextualLinkManager instance.

File

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

Code

function hook_contextual_links_plugins_alter(array &$contextual_links) {
    $contextual_links['menu_edit']['title'] = 'Edit the menu';
}

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