I'm using several nodes as node profiles. They are set up in local navigation tabs, which I created by using a custom module and hook_menu. When I click on the Edit tab, I see the secondary local navigation showing links to all of the node profiles. After I edit one of the nodes, I am always returned to the first tab. I'd like the user to be brought to the tab that was just edited.
To do this, I am trying to add a "?destination=..." redirect to $form['#action'] on each node_profile_edit_form by overriding the variable using hook_form_alter(). If I print the $form variables at the bottom of the form page, I can see that the $form['#action'] variable has taken my edit - but it doesn't work when I click the submit button - I am still taken to the first tab. I looked in $form and saw that there are two #after_build functions set: node_form_add_preview and nodeprofile_integration_adapt_node_form. Is it possible that these functions are preventing my override from working?
Thanks for the great modules!
Comments
Comment #1
voidengine commentedWell, I looked closer and disovered that the form elements I was trying to override were part of user_edit. I'm guessing that this is an outcome of the subform_element module. So I tried overriding elements in user_edit and it worked! I had to use if/then structures with the path arg's to make sure I was on the right sub page of user-edit, but it worked.
Comment #2
fagogreat!
Just to let you know: as an alternative you could also form_alter to "main form" and add another subform after build handler, that you can use to alter the subform, and the subform only - without hardcoding to paths.
Comment #3
(not verified) commented