Contextual links

Contextual links are used by the Contextual module to provide handy links next to a given component (a render array). You probably encountered this when hovering over a block, for example, and getting that little icon with a dropdown that has the Configure block link:

Contextual links are tied to render arrays. In fact, any render array can show a group of contextual links that are previously defined.

Modules can define contextual links inside a module_name.links. contextual.yml file, whereas other modules can alter them by implementing hook_contextual_links_alter().

Get Drupal 8 Module Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.