/Drupal 8

function hook_contextual_links_plugins_alter

hook_contextual_links_plugins_alter(array &$contextual_links)

Alter the plugin definition of contextual links.


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


Related topics

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


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


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

© 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.