$items [' items '] = Array ( l (' Configure ', ' admin/config '), L (' Structure ', ' admin/structure '),); $theme = Theme (' Item_list ', $items);
1, judging if all the modules are loaded,
if (!module_load_all (NULL) &&! defined (' Maintenance_mode ')) { thrownewException(t (' theme () May is called until all modules is loaded. ') )); }
2, get all the themeregistry information, this information is the Hook_theme array of all module definitions, and merge many default information, such as process function, function, render array, variables , etc
$hooks = theme_get_registry (FALSE);
3, get the themeregistry information corresponding to this Themehook
$info $hooks [$hook];
4, if Hook_theme defines the includes, then load the function
if (! Empty ($info[' includes '])) { foreach ($infoas$include _file) { include_once $include _file; } }
5, $variable and themeregistry correspond to the variable merger of this hook.
if (! Empty ($info[' variables '])) { $variables$info[' variables ']; }
6, $info inside process preprocess function is called
$processor _function ($variables$hook _clone);
7, if $variable[' theme_hook_suggestion ' is changed in the process preprocess function, it will reload $hook
$info $hooks [$suggestion];
8, the function inside the $info will be transferred to handle $variable
$output $info [' function '] ($variables);
How does the theme (' Item-list ', Array (' Items ' =>array (' aaa ', ' BBB ')) work?