0

I would like to all the href of the edit tab link on several nodes.

IOW: instead of

example.com/node/%/edit

I would like to substitute my dynamically created link

example.com/products/$myproductid/edit

My first stab at this (just to see if I understood the wild cards):

function jch_utilities_menu_alter(&$items) {
  $items['node/%node/edit']['title'] = '1234';
} 

...and this fires, BUT I don't understand how to pass the URL I want dynamically to it.

What I want to do is pass a variable from the node (a field variable) to that link.

I see that there is a page callback member of the array but that seems to call the node_edit page... which is over my head. I can't find a simple clear example of how to do this without a -lot- of study.

Is there no way to simply -force- a link href as one could do with jQuery?

TIA.

1 Answer 1

0

You can use a module call Sub Path Auto

here is a help video with an example that should work for you.

Module description :

For example, if user/1 is aliased to users/admin, this module rewrites the link to the user contact page user/1/contact to use the aliased URL users/admin/contact instead. This also includes Views URLs taking a node as argument (e.g. node/%/yourview), in short, every URL that is based on, or extends, an existing alias. In combination with the Pathauto module it is possible to get rid of all remaining exposed internal non-administrative URLs.

2
  • Thanks, but I want to pass a -variable- from the node to the callback function which builds the link.
    – jchwebdev
    Commented Nov 19, 2014 at 23:01
  • Ok, what variable are you trying to pass where ? You might be able to use the module mentioned above and a hook_form_alter() or something. Commented Nov 19, 2014 at 23:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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