I'm trying to change the way my node/add form redirects because at the moment when a user submits a "create new node" form they are redirected to the custom page.tpl that I have created, but with no content shown. They don't get any way provided to get back to the admin interface apart from their back button.
So what I want to do is create a function in the template.php file so I can change the #redirect element of the form. But baby steps first, I'm just trying to add a string of text into the top of it to start with so I know I'm targeting the form;
function mythemename_theme() {
return array(
'product_node_form' => array
(
'arguments' => array('form' => NULL),
),
);
}
function mythemename_product_node_form($form){
$output = '<h1>TEST</h1>';
$output .= drupal_render($form);
return $output;
}
But it doesn't seem to do anything to the form.
Any ideas?
TIA
Comments
If you want to change the
If you want to change the #redirect value, do it from hook_form_alter() in a custom module.
Thanks theabacus
So looking atthe api for hook_form_alter I see that it says;
I want to do this with any node add form eventually but for now I'm concentrating on one (it has the id of product_node_form).
This is what I have in my new module that I created called newnode_redirect, which is enabled.
Can you see anything wrong with that? And what else do I need to do to call this function? I was under the impresion that it would be called when the hook_form_product_node_form was invoked?
Thanks loads for helping.
EDIT;
IT was me being stupid as usual, did a bit of poking around and managed to get it working in a rudimentary form by using this ;
Thanks for your help.