Download & Extend

With hook_form_$form-id_alter() module's weight might be insignificant

Project:Drupal core
Version:7.x-dev
Component:forms system
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed (works as designed)

Issue Summary

In drupal_prepare_form() - hook_form_$form-id_alter() execution is separate and prior to hook_drupal_alter() execution, resulting with a module's weight being insignificant in the following scenario:

A module implements hook_form_alter() and module weight = 0;
B module implements hook_form_$form-id_alter() and module weight=30; However it will be executed before A module.

This limits the power of hook_form_$form-id_alter() in tidying the code.

Comments

#1

Status:active» closed (works as designed)

The same can be said if we switch these around. Someone always gets to go last - thats the premium position in drupal. This is a timeless problem and we are actually on the verge of solving it since we have hook implementations in the registry now and can add a weight to each one.

#2

Status:closed (works as designed)» active

Well, we could swap the order if people want.

#3

Status:active» closed (works as designed)

Also from conversation in IRC with chx and webchick I understand that updating the docs might be good enough - #331832: Document hook_form_FORM_ID_alter().