5

I have started learning Drupal for few months. Now I'm doing some theming.

I would like to know the execution order of preprocess functions.

1 Answer 1

10

The order in which the preprocess functions are called in Drupal 7 is

  1. template_preprocess
  2. template_preprocess_HOOK
  3. MODULE_preprocess
  4. MODULE_preprocess_HOOK
  5. ENGINE_engine_preprocess
  6. ENGINE_engine_preprocess_HOOK
  7. THEME_preprocess
  8. THEME_preprocess_HOOK
  9. template_process
  10. template_process_HOOK
  11. MODULE_process
  12. MODULE_process_HOOK
  13. ENGINE_engine_process
  14. ENGINE_engine_process_HOOK
  15. THEME_process
  16. THEME_process_HOOK

Source : https://api.drupal.org/api/drupal/includes!theme.inc/function/theme/7

4
  • 1
    I guess the question is regarding the execution order of preprocess_html, preprocess_page, preprocess_node etc.
    – Bhuvana
    Apr 10, 2015 at 7:23
  • @Bhuvana yes I was expecting that... Apr 10, 2015 at 7:59
  • 2
    As far as my understanding goes it is 1) hook_preprocess_node 2)hook_preprocess_page and 3)hook_preprocess_html
    – Bhuvana
    Apr 10, 2015 at 10:56
  • @Bhuvana nope, it goes other way around. preprocess_page runs before the preprocess_node. Jun 13, 2019 at 14:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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