Last updated July 12, 2013. Created by arianek on December 10, 2009.
Edited by ezheidtmann, dman, bmadore, SqyD. Log in to edit this page.

In Drupal 7, some modules supply contextual links that allow privileged users to quickly perform tasks that are related to regions of the page without navigating to the Admin Dashboard. For example, when you hover your mouse over a block or node, links are displayed that allow you to make changes to the block or node.


Uses

You can enable and disable contextual links and you can specify the user roles that have permission to view and use contextual links.

Enabling contextual links

To enable the Contextual links module:

  1. Navigate to the modules administration page (Administer > Modules).
  2. In the Core section of the Modules page, enable the Contextual Links module
  3. Click Save Configuration.

Configuring contextual links permissions

To set permissions for different user roles to access the contextual links:

  1. Navigate to the Permissions page (People > Permissions tab).
  2. For each role you can enable or disable the Use contextual links permission.
  3. Click Save Permissions.

Note that contextual links are not displayed if the user does not have permission to perform the specific action represented by the link.

Displaying contextual links

When using default rendering, the normal teaser view will embed the contextual links on nodes for you.

If using a customized theme, your node template should include the normal renderable elements found in core's node.tpl.php. Specifically, the contextual links are provided by the line

<?php
      
print render($title_suffix);
?>

$title_suffix is where these functions are usually inserted. The same should apply to blocks and other places contextual links are available.

In order for the contextual links to be positioned correctly, you must ensure the "contextual-links-region" class is present on a containing element. The theme system will usually provide this class in the $classes variable in your node template, but if you are overriding classes or specifying them directly in the template, you will have to add this class explicitly.

Contextual links are not available by default to views with "field" based rows.

Looking for support? Visit the Drupal.org forums, or join #drupal-support in IRC.