Hello Carl and Others,
Thanks for your code sample. I must say however I couldn't get it to work as the theme function: node_page_edit is never called...? And I'm at a loss how this is supposed to work? Maybe it's just me...
Instead I got Eclipse+XDebug installed, something I've been wanting to do for a while and watched some more videos on Drupal 7's changes on Form/Array rendering API.
My approach was to go back to the array variable itself, with HOOK_form_FORM_ID_alter() and to add, move and change the values there, combined with HOOK_page_alter() and I've gotten it all working correctly now.
Thank you all for your time and assistance!
Sincerely,
Sebastian.
On 2011-10-11 9:18 PM, Carl Wiedemann wrote:
I've never heard of THEME_form_hook_alter().
template.php is generally for theme override functions. That is, the functions in this file will be overriding the output of existing theme functions which are defined by hook_theme.
Drupal themes only serve to rewrite existing output. All original output in Drupal is defined by theme functions, which appear modules. The stark theme is a nice working example of this -- notice that there are no included templates. Markup starts with modules.
In your case, you have only defined the override, not the originating theme function. So, in your module, you need to so something like the following: http://pastebin.com/vkXbxeX7
This will require a cache clear such that the theme registry will now know about hook_theme().
Carl Wiedemann Website design and development consulting carl.wiedemann@gmail.com mailto:carl.wiedemann@gmail.com | skype: c4rlww
On Mon, Oct 10, 2011 at 11:34 PM, sebastian <inforazor@gmail.com mailto:inforazor@gmail.com> wrote:
Hello, Very sorry to ask this, but I am going in a loop with the documentation, and the IRC chat isn't helping much either... so I hope this won't take much of your time. I understand in D7 that we can write in a custom module for form alterations such as: file: webadmin_ui.module //this is a custom module I made function webadmin_ui_form_page_node_form_alter(&$form, &$form_state, $form_id) { dpm ($form);//see values //change values as you please here... } And I also understand that in D7 we REMOVED the feature/function to alter the form values in the THEME layer, so this function was killed: THEME_form_hook_alter($form) {} Because supposedly I can theme it via different methods. In the $form variable, when I DPM it [see above] I note the theme-chain: dpm($form) outputs: [among other things] $form['#theme']['page_node_form'] $form['#theme']['node_form'] If I try and be "smart" and write in my template.php: mytheme_page_node_form($form) { dpm("it works!"); } I clearly get nothing as this function is never called. Can I add my own function call to this list? If so, how? Is there documentation on this anywhere? The documentation in D6 was a mess, and for this in D7 its really no better [maybe even worse cause I keep hitting D6 pages mixed into D7 ones with no warning]. The whole point of all this is I want to understand how I can not only modify the form BEFORE it gets rendered, but also alter HOW the form is rendered... wrap some parts in a DIV, maybe add a missing CLASS or ID etc. Ideas? Thank you kindly, Sebastian. -- [ Drupal support list | http://lists.drupal.org/ ]