Drupal 9/10 dynamic routes
Building dynamic routes , that are built based on some custom rules (like taxonomy terms, etc) involve the following:
- Creating a service that is listening to routing.route_alter event;
- Implementing a class that alters the route collection;
Creating a route alter event listener
Create src/EventSubscriber/RouteSubscriber.php class stub in your module directory. In this file, add the namespace and create a dummy class that extends Drupal\Core\Routing\RouteSubscriberBase.
- Read more about Drupal 9/10 dynamic routes
- Log in to post comments