Best practices for hook_form_alter()

Drupal: 10m
Video Series
Information

The ability of having alter hooks within the theme layer starts to blur the line between the logic and presentation, and so there are a few things to be aware of when using hook_form_alter() from the theme layer. The biggest thing to know is that the form rendering process has already gone through the creation and validation preparation process at the module layer, and so you shouldn't be drastically changing the functionality of a form at the theme layer. This form alter hook at the theme layer is primarily for aesthetic clean-up, styling and additional design. This chapter gives some specific examples of things to watch out for.

Discussion

Comments

You need to be an active subscriber to comment. or .
Lullabot logo

Lullabot has trained thousands of Drupal developers & guided the development of some of the largest Drupal websites.