Working with contextual links

Last updated on
27 June 2019

In Drupal 8, 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.

To install the Contextual links module:

  1. Navigate to the modules administration page (Extend).
  2. In the Core section of the Modules page, enable the Contextual Links module
  3. Click Install.

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.

This page contains a rough guide for adding new contextual links in a custom module of your own.

For more information check out the API page for Providing module-defined contextual links.

Help improve this page

Page status: No known problems

You can: