0

I know how to create a URL with hook_menu() in a module, but is it possible outside a module?

Here's what I'm needing/asking:

My front-end guy wants to create a page as a node using a Content Type via the Content menu. The URL for this content type needs to be something like www.somesite.com/some-page/arg1/arg2. Can this be done without a module defining the route with hook_menu() in a module?

If so, in my module that needs to do the work, it needs to collect these args and use them to insert data into the DB.

Is it possible for him to create a path with arguments that I can get? If so, what would be the best way to get these args to my module that is going to work on the backend.

I could do this all day with hook_menu() in module, but the front-end guy seems adamant that he can create a node and get the args from it's path. I don't understand how he can do that.

Thanks in advance. Cy

-1

https://www.drupal.org/project/pathauto will help you on your quest ... to do this make custom fields to collect the arguments then use tokens to replace them...

Edit:

but if your developer is using the front end to create content (nodes) its easy to create path arguments ... my idea was to make the fields to help generate the "path" ... then in your module you have to simply load the node then access the fields .. sure there is more ways to do this like look in to the path and explode out the "/" then use them but way easier just to get from the loaded node object.

other than that can you please up date your question to be more clear

2
  • Please explain. I am a backend person, so I don't mess with this often. I need to see what you are talking about and how to do it. We already use pathauto, and the idea here is not to add to or create a content type. While that may not be possible, I don't know. Which is why I need instruction, please.
    – Cy Jobes
    Aug 18 '20 at 19:18
  • Updated answer for your comment
    – taggartJ
    Aug 18 '20 at 23:27

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.