1

What if I have the following route in a custom module and a path alias that is equal to the route path?

mymodule.contact:
path: /contact
defaults:
    _controller: Drupal\mymodule\Controller\MyController::contact
requirements:
    _permission: 'access content'
  • 1
    If I recall correctly, the alias gets priority. or maybe it was the other way around. What have you found? – Jaypan Jun 21 '19 at 8:21
  • 1
    I searched for it i didn't find any answer ! I think you are right aliases are called first – Hmad AmEdur Jun 21 '19 at 8:32
  • 1
    I had this same issue yesterday - aliases get called first. – Janey Jun 21 '19 at 8:43
0

The alias gets priority over the route.

  • This was the question "What if I have the following route in a custom module and a path alias that is equal to the route path?" The answer is what I said, the alias takes priority over the route. Even the comments of the OP say exactly that. I don't know how this doesn't provide an answer. – Frank Robert Anderson Oct 7 '19 at 13:53
  • 1
    To be an answer, it lacks references. May you point out where exactly the documentation says a path alias has priority over a module route? If you understood that looking at the Drupal core code, may you show the code that is taking care of routes / path aliases resolution? – kiamlaluno Oct 16 '19 at 12:58
  • What about if neither is the case. I cannot point to the code and there is no documentation that says it. But I have done exactly this. I have created a route and a path alias with the same value and the alias takes priority. Are you saying that because I have personal experience, and not official Drupal documentation, with this that I shouldn't answer the question? – Frank Robert Anderson Oct 17 '19 at 13:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.