I'm working on a module which will resolve URLs to entities by altering inbound URLs so that if they contain an entity ID with following pattern "-{entity_id}" user will be redirected to correct URL.
A working example of the above:
Final URL:
http://romajazz.it/concerti/pozzovio-de-angelis-4902 Using the aliases:
- http://romajazz.it/concerti/i-can-type-anything-here-4902
I researched for a while; I found out there was hook_url_inbound_alter()
in Drupal 7 which could solve this problem.
I also found that there is InboundPathProcessorInterface
in Drupal 8.
I thought about implementing InboundPathProcessorInterface
and use it in EventSubscriberInterface
implementation which will subscribe on KernelEvents::REQUEST
.
I wonder if this approach is correct. Are there any other ways of doing this in Drupal 8?