[development] Overriding function declared in another module

Jennifer Hodgdon yahgrp at poplarware.com
Tue Jan 18 16:37:13 UTC 2011


I just filed an issue:
http://drupal.org/node/1031458

The doc is only incorrect in D6. In D7 the order has changed.

    --Jennifer


On 1/18/2011 7:37 AM, Justin Ellison wrote:
> Code speaks truth, you're correct.  However, there's some
> contradicting documentation.
>
>> From http://api.drupal.org/api/drupal/modules--system--system.api.php/function/hook_form_alter/7:
> "For each module (in system weight order) the general form alter hook
> implementation is invoked first, then the form ID specific alter
> implementation is called."
>
>> From http://api.drupal.org/api/drupal/developer--hooks--core.php/function/hook_form_FORM_ID_alter/6:
> "Note that this hook fires before hook_form_alter(). Therefore all
> implementations of hook_form_FORM_ID_alter() will run before all
> implementations of hook_form_alter(), regardless of the module order."
>
> Unfortunately, Google returns the former link first, which must've
> been what I learned from.
>
> Sorry for any confusion,
>
> Justin
>
> On Tue, Jan 18, 2011 at 9:26 AM, Steve Ringwood<nevets at tds.net>  wrote:
>> Justin
>>
>>     Not sure what you are referring to in the docs for hook_form_alter but
>> here is the relavent code
>>     from form.inc, function drupal_prepare_form().
>>
>>   $data =&$form;
>>   $data['__drupal_alter_by_ref'] = array(&$form_state);
>>   drupal_alter('form_'. $form_id, $data);<<  Form ID specific call
>>
>>   // __drupal_alter_by_ref is unset in the drupal_alter() function, we need
>>   // to repopulate it to ensure both calls get the data.
>>   $data['__drupal_alter_by_ref'] = array(&$form_state);
>>   drupal_alter('form', $data, $form_id);<<  General call (hook_form_alter)
>>
>> Nevets
>>
>>
>


-- 
Jennifer Hodgdon * Poplar ProductivityWare
www.poplarware.com
Drupal web sites and custom Drupal modules



More information about the development mailing list