Drupal Association members fund grants that make connections all over the world.
template_preprocess() we say:
Adds a default set of helper variables for variable processors and templates. This comes in before any other preprocess function which makes it possible to be used in default theme implementations (non-overridden theme functions).
theme() we say:
template_preprocess(&$variables, $hook): Creates a default set of variables for all theme hooks.
template_preprocess() does NOT run for all theme hooks. It does not run for theme functions at all, even though they are “theme hooks,” and even if the theme function has implemented it’s own preprocess function. It only runs for theme hooks implemented using templates, as indicated further down in the documentation:
If the implementation is a function, only the theme-hook-specific preprocess and process functions (the ones ending in _HOOK) are called from the list above. This is because theme hooks with function implementations need to be fast, and calling the non-theme-hook-specific preprocess and process functions for them would incur a noticeable performance penalty.
A little further down in
theme() we say:
There are two special variables that these preprocess and process functions can set: ‘theme_hook_suggestion’ and ‘theme_hook_suggestions’. These will be merged together to form a list of ‘suggested’ alternate theme hooks to use, in reverse order of priority. theme_hook_suggestion will always be a higher priority than items in theme_hook_suggestions. theme() will use the highest priority implementation that exists. If none exists, theme() will use the implementation for the theme hook it was called with. These suggestions are similar to and are used for similar reasons as calling theme() with an array as the $hook parameter (see below). The difference is whether the suggestions are determined by the code that calls theme() or by a preprocess or process function.
Wrong. You can implement theme hook suggestions all you want, but they will only work under certain circumstances and are actually processed 3 different ways. See.
PASSED: [[SimpleTest]]: [MySQL] 36,811 pass(es). View
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch 1333122-4.patch. Unable to apply patch. See the log in the details link for more information. View