0% found this document useful (0 votes)
90 views

Theme Flow 6 1

The theme() function in Drupal allows modules and themes to output dynamic content. It first checks the theme registry for the specified hook, then looks for template files and preprocess functions associated with that hook. Variables are built and passed between preprocess functions by reference to provide template files with all necessary data.
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
90 views

Theme Flow 6 1

The theme() function in Drupal allows modules and themes to output dynamic content. It first checks the theme registry for the specified hook, then looks for template files and preprocess functions associated with that hook. Variables are built and passed between preprocess functions by reference to provide template files with all necessary data.
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 1

theme function call for Drupal 6.

x
theme('hook', $arguments) http://api.drupal.org/api/function/theme/6

[ load theme registry ]


[ check hook for *wild cards ]

if hook is function

f.a themeName_hook($arguments) template.php


or
f.b engineName_hook($arguments) .engine

f.c theme_hook($arguments) .module/.inc


[ default implementation as function ]

else hook is template

[ convert $arguments into variables ]


[ check for render function, defaults to theme_render_template ]
[ check for extension function and run, defaults to ".tpl.php" ]
preprocess functions
template_preprocess theme.inc
t.a
[ set variables & suggestions ] template_preprocess_hook .module/.inc

moduleName_preprocess .module
All variables passed by reference moduleName_preprocess_hook t.b
between each preprocess function.
As a result, variables are additive engineName_engine_preprocess .engine
building the variables array.
engineName_engine_preprocess_hook t.c

engineName_preprocess template.php
engineName_preprocess_hook t.d
themeName_preprocess
themeName_preprocess_hook

[ collect suggestions ]

drupal_discover_template
[ find implemented suggestion ]

theme_render_template

[ assemble .tpl.php file ]

suggestion default hook

suggestion.tpl.php hook.tpl.php
<html> <html>
<?php print $variable ?> <?php print $variable ?>
</html> </html>

You might also like