Add a Contextual Link in a Module for Drupal 8, Drupal 9

Last updated March 9, 2022
Module Development8.9.x/9.3.x

Contextual links provide yet another method for Drupal module developers to add helpful links for site administrators to quickly navigate to commonly used tasks. In this tutorial we'll learn how to implement and render contextual links from a custom module. We will also look at a pair of alter hooks that can be used to tweak existing contextual links.