Weights are not the solution? Re: [development] altering an alteredform

Jeremy Epstein jazepstein at gmail.com
Sat Jun 10 02:03:37 UTC 2006

On 6/10/06, Nedjo Rogers <nedjo at islandnet.com> wrote:
> Maybe a simple (?) solution would be to register not all hooks but only
> their dependencies.
> function example_hook_dependencies() {
>   return array(
>     'form_alter' => array(
>       '#before' => array('node'),
>       '#after' => array('user')
>     ),
>     'menu' => array(
>       '#before' => array('node')
>     )
>   );
> }

This would be an extremely useful mechanism, and I think that for the
vast majority of cases, it would work very well. However, there would
be some cases where dependency conflicts could occur, and I envision
that if/when these happen, they could potentially get very messy.

E.g. let's say 3 modules in core (A, B, and C), have no dependencies
defined for hook_form_alter(). Then the contrib modules D and E come
along, and each define their own dependencies. How would this case be

- Module D's hook must be called after module A, and before modules B and C.
- Module E's hook must be called after module C, and before module A.

I can think of no clean solution to the problem above. But then again,
I was never much good at those maths problem-solving puzzlers. Maybe
the more outside-square-thinking among us can see a way around cases
such as this. :p


More information about the development mailing list