function hook_menu_contextual_links_alter


Error message

User warning: The following module is missing from the file system: theme/theme. For information about how to fix this, see the documentation page. in _drupal_trigger_error_with_delayed_logging() (line 1156 of /var/www/html/elmsln_community/
cis7 system.api.php hook_menu_contextual_links_alter(&$links, $router_item, $root_path)
cle7 system.api.php hook_menu_contextual_links_alter(&$links, $router_item, $root_path)
elmsmedia7 system.api.php hook_menu_contextual_links_alter(&$links, $router_item, $root_path)
icor7 system.api.php hook_menu_contextual_links_alter(&$links, $router_item, $root_path)
meedjum_blog7 system.api.php hook_menu_contextual_links_alter(&$links, $router_item, $root_path)
mooc7 system.api.php hook_menu_contextual_links_alter(&$links, $router_item, $root_path)

Alter contextual links before they are rendered.

This hook is invoked by menu_contextual_links(). The system-determined contextual links are passed in by reference. Additional links may be added or existing links can be altered.

Each contextual link must at least contain:

  • title: The localized title of the link.
  • href: The system path to link to.
  • localized_options: An array of options to pass to url().


$links: An associative array containing contextual links for the given $root_path, as described above. The array keys are used to build CSS class names for contextual links and must therefore be unique for each set of contextual links.

$router_item: The menu router item belonging to the $root_path being requested.

$root_path: The (parent) path that has been requested to build contextual links for. This is a normalized path, which means that an originally passed path of 'node/123' became 'node/%'.

See also





Related topics

2 functions implement hook_menu_contextual_links_alter()

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

context_ui_menu_contextual_links_alter in sites/all/modules/ulmus/context/context_ui/context_ui.module
Implementation of hook_menu_contextual_links_alter().
rubric_menu_contextual_links_alter in sites/all/modules/elmsln_contrib/rubric/rubric.module
Implements hook_menu_contextual_links_alter().
1 invocation of hook_menu_contextual_links_alter()
menu_contextual_links in includes/
Retrieves contextual links for a path based on registered local tasks.


modules/system/system.api.php, line 1561
Hooks provided by Drupal core and the System module.


function hook_menu_contextual_links_alter(&$links, $router_item, $root_path) {
  // Add a link to all contextual links for nodes.
  if ($root_path == 'node/%') {
    $links['foo'] = array(
      'title' => t('Do fu'),
      'href' => 'foo/do',
      'localized_options' => array(
        'query' => array(
          'foo' => 'bar',