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

johnalbin’s picture

Version: 7.x-5.1 » 7.x-5.x-dev
Category: bug » support
Status: Active » Postponed (maintainer needs more info)

You 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.

johnalbin’s picture

Status: Postponed (maintainer needs more info) » Closed (cannot reproduce)
johnalbin’s picture

Issue summary: View changes

change page to form...