Theme functions are defined in the template.php
but is it possible to define hook functions in there? for example There is a content type called phone-book
, its add content form ID is phone-book-node
, I want it to redirect to my custom page when it is submitted. so I created this function in the template.php
:
function MYTHEME_form_phone_book_node_form_alter(&$form, &$form_state, $form_id) {
$form_state['redirect'] = 'go/some/where';
}
but it doesn't work. I don't know if it is totally impossible to define such hook functions inside template.php
or something is wrong with my code.