Overiding #theme in hook_form_alter()
I've written the module that wants to override the #theme of another module's form. I discovered that in hook_form_alter I cannot set the #theme field because drupal_get_form overrides #theme after calling hook_form_alter it if the function theme_<formname> exists or the $callback argument is provided. This seems like an unintentional restriction to me. Is it? Hook_form_alter can change everything else about a form, so why should it not be able to change the #theme field? I know the theme function can be overridden by the site theme but that forces the module not to be self-contained. The workaround I found is to add a callback to the form's #pre_render array that sets the form's #theme field. This works fine (because #pre_render is invoked after drupal_get_form overrides #theme) but is certainly not intuitive; if this really is the best way to do it, I'll author a new page for the Forms API Tips and Tricks book section. Thanks, Barry Note: This message was dictated using voice recognition software. Please excuse any errors I missed.
This seems like an unintentional restriction to me. Is it?
i would think yes. patches welcome.
Note: This message was dictated using voice recognition software. Please excuse any errors I missed.
wow - i didn't notice any errors. i want some of that dictation technology.
This seems like an unintentional restriction to me. Is it?
i would think yes. patches welcome.
Issue and patch submitted.
Note: This message was dictated using voice recognition software. Please excuse any errors I missed.
wow - i didn't notice any errors. i want some of that dictation technology.
I use Dragon NaturallySpeaking 8. It does make mistakes, I just fix them before sending. For e-mail, it really isn't that bad, and it is much better than aggravating my RSI. Thanks, Barry Note: This message was dictated using voice recognition software. Please excuse any errors I missed.
participants (2)
-
Barry Jaspan -
Moshe Weitzman