Introduction
Drupal's design stresses the separation of logic from presentation with the former being handled by modules and the latter by themes. Theme functions, commonly those that are prefixed with theme_
, and theme template files act as a bridge between the two as they are designed to be overrideable. All theme functions and template files are tracked by Drupal's theme system and cataloged in a theme registry. Modules and themes are expected to declare their theme functions and templates through the use of a function named hook_theme()
. This function is parsed for each module and theme and the resulting registry is cached in the database.
What this registry does is allow developers to modify and override existing theme implementations with their own customizations. If the registry states that for task foo
, theme function bar()
has to be used, we can modify the registry to point to our own function named baz()
instead of bar()
which does something entirely different.
For example, let...