Actions links are links that appear in various places in the Drupal admin interface and allow users to perform common tasks. You can add your own custom actions links with route parameters and query parameters to make it easier for users to perform specific tasks in your Drupal site.

In this blog post, we'll look at how to add an actions link with route parameters and query parameters in Drupal 10.

First, we need to define our link in a YAML file. To mymodule.links.action.yml, add:

speaker.add_speaker:
  route_name: node.add
  route_parameters:
    node_type: speaker
  options:
    query:
      destination: '/admin/content/speakers'
  title: 'Add a speaker'
  appears_on:
    - view.content.page_2

This creates a nice looking button that will take me right to /node/add/speaker?destination=/admin/content/speakers

Drupal action link

Adding an actions link with route parameters and query parameters in Drupal 10 is a simple process that can make it easier for users to perform specific tasks in your Drupal site. By defining the link in a YAML file and clearing the cache, you can add your own custom actions links with ease.