I have a form in my website with id: sample_test_custom_form. I have used hook_form_alter in a custom module to alter this form. I also have a preprocess function (mytheme_preprocess_sample_test_custom_form) to do a little preprocessing.

However the alter function and the preprocess function are a little dependent on each other.

So I ask, what is the execution sequence of these function? Which of them is executed first?

1 Answer 1


Here's a diagram of the form build workflow in Drupal 7

Drupal 7 form building process

More info: https://drupal.org/node/165104

  • It is quite informative but doesn't say anything about the preprocessing unless preprocessing is a part of form building. Is it?
    – kmdhrm
    Nov 19, 2013 at 10:15
  • 2
    Preprocessing is part of the theme layer. It will happen after form_alter Nov 19, 2013 at 10:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.