What functions do I need to call to add my own button/tab to a pageroute? I would like to allow users to exit the route without completing it (after a certain point). I'd like the button to point either to a URL of my choosing, or to the destination from the URL.
I have tried to add a tab via the hook_menu, but that doesn't work at all for button-tabs. Regular-style tabs shows my added tab (it's a MENU_LOCAL_TASK), but the link doesn't work as expected. I set the path to $pageroute .'/return', where $pageroute is of course the page route. This has a callback function of drupal_goto, with the callback argument set to my desired URL. However, this doesn't work either. If I am on the page 'PAGE' of the page route and I click on my tab, I am taken to the page I started from, but the URL reads $pageroute/'PAGE'/return instead.
HELP!
Comments
Comment #1
rconstantine commentedIt appears pageroute_show_route is firing even though I set the callback of my menu item to drupal_goto. Any ideas why? Is my item being unset somewhere after I set it?
Comment #2
fagohm if you register your own menu item, it should get active, if its path is more specific as pageroutes menu item.
Anyway, an easy way to implement this would probably be:
* implement your own pageroute page type
* or use the node display page type and set it to show a node, which contains your php code
Comment #3
rconstantine commentedThe following is the code I added to my module:
As the note indicates, it doesn't work the normal way, so I inserted a session variable called myarg. My arg is checked here:
This is, of course, a hack to your module to get this to work. And it does work just fine. The problem is that it shouldn't be necessary and I haven't been able to figure out the problem - i.e. the callback from the menu item itself never fires. In fact, I can put anything in there and nothing happens. Also, this naturally won't show up if using buttons for tabs, so now I only have next/prev/submit at the bottom to save the contents of the node.
This is for the http://drupal.org/project/nf_registration_mod module, but this code has not been released since I'm not yet sure of its stability. Side note: weight of the modules didn't seem to do anything. If you'd like to play with my module, I could zip the current version and post it here. It allows you to have several different membership types, each with its own pageroute. There can be pages in common and unique pages to each route. I can't use your user edit integration because it looks for nodeprofile types in general, and not for a pageroute associated with a user, so I implemented that myself originally. I'm sure you saw my other post about not being able to save content when edited from the node directly. I'll comment more about this over there: http://drupal.org/node/177874
Comment #4
fagoehm, pageroute doesn't register the user/XX/edit path, but the user module does! If you define further categories with hook_user, user/XX/edit/$category is used, however I don't think that these are registered menu callbacks.
Furthermore be sure to make use pageroutes API documentation, e.g. instead of hacking pageroute for the redirect it should be also possible to use hook_pagerouteapi op 'boot'
Comment #5
Tauran commentedReopen if needed.