解析theme()
drupal_render()只是对theme()的调用做了包装,真正做任务的还是theme()。 function theme($hook, $variables = array()) { ... ... } theme()的开头检查了module_load_all()是否有执行。theme()只能在所有模块装入后才能执行。 // If called before all modules are loaded, we do not necessarily have a full // theme registry to work with, and therefore cannot process the theme // request properly. See also _theme_load_registry(). if (!module_load_all(NULL) && !defined('MAINTENANCE_MODE')) { throw new Exception(t('theme() may not be called until all modules are loaded.')); } theme_get_registry()返回所有的theme hooks。 $hooks = theme_get_registry(FALSE); 参数