i tried to implement a hook_form_alter in the template.php file of my zen subtheme. it would not fire. everything worked fine if I added the same code to sites/all/modules/MODULE/MODULE.module or sites/all/themes/zen/template.php. i believe this may be a bug. to duplicate the behavior repeat the following:
1. create a new subtheme from the zen starterkit following the starterkit README.
2. add the following to sites/all/themes/foo/template.php
function foo_form_alter(&$form, &$form_state, $form_id) {
drupal_set_message('<pre>'.print_r($form_id,TRUE).'</pre>');
}
3. drush cc all
4. view a form...no form_id's....
5. add the same snippet to sites/all/themes/zen/template.php
6. drush cc all
7. view a form...form_id's...
don't think i've done anything stupid and i see lots of people complaining on the web about how hook_form_alter is not firing in template.php. they may be using a zen subtheme?
Comments
Comment #1
johnalbinYou don't list making the sub-theme the active theme on the site.
I've never experience this problem and I've done form altering from the theme many times.
Comment #2
johnalbinComment #2.0
johnalbinchange page to form...