Contextual links allow the user to perform actions directly on a particular entity or other portion of the site. Adding one is done by creating a {module}.links.contextual.yml file in the root directory of your module. In order to add a contextual link for the mastering_drupal_8 module, it would look like:
mastering_drupal_8: title: 'Test' route_name: 'mastering_drupal_8.test_page_block' group: 'block'
For each contextual link element, you have the following attributes:
- title: Title of the link in the contextual link area
- route_name: Machine name of the route that the contextual link directs to
- group: Area the contextual link appears in for example, "block," "menu," and so on
- weight: Determines the order of the contextual ...