summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2009-10-15 12:27:34 +0000
committerDries Buytaert <dries@buytaert.net>2009-10-15 12:27:34 +0000
commit35e21e54e1122f98bede28f89d80f2fb13b3fd97 (patch)
treeb757a831278a4dbc99a3ae5042cc37f95f53aacb /includes
parent5acbec27001aa382699cf144d9a953c9b725bc01 (diff)
downloadbrdo-35e21e54e1122f98bede28f89d80f2fb13b3fd97.tar.gz
brdo-35e21e54e1122f98bede28f89d80f2fb13b3fd97.tar.bz2
- Patch #412730 by Crell, jbomb, JohnAlbin: theme system should report when a theme key is not found.
Diffstat (limited to 'includes')
-rw-r--r--includes/theme.inc16
1 files changed, 11 insertions, 5 deletions
diff --git a/includes/theme.inc b/includes/theme.inc
index 5cff69f6a..d2c5d6e64 100644
--- a/includes/theme.inc
+++ b/includes/theme.inc
@@ -37,6 +37,12 @@ define('MARK_UPDATED', 2);
* @} End of "Content markers".
*/
+
+/**
+ * An exception to throw when a theme function is requested that does not exist.
+ */
+class ThemeHookNotFoundException extends Exception {}
+
/**
* Determines if a theme is available to use.
*
@@ -256,7 +262,7 @@ function _theme_load_registry($theme, $base_theme = NULL, $theme_engine = NULL)
else {
// If not, build one and cache it.
$registry = _theme_build_registry($theme, $base_theme, $theme_engine);
- // Only persist this registry if all modules are loaded. This assures a
+ // Only persist this registry if all modules are loaded. This assures a
// complete set of theme hooks.
if (drupal_get_bootstrap_phase() == DRUPAL_BOOTSTRAP_FULL) {
_theme_save_registry($theme, $registry);
@@ -762,7 +768,7 @@ function theme($hook, $variables = array()) {
}
if (!isset($hooks[$hook])) {
- return;
+ throw new ThemeHookNotFoundException(t('Theme hook "@hook" not found.', array('@hook' => $hook)));
}
$info = $hooks[$hook];
@@ -2139,7 +2145,7 @@ function template_preprocess_html(&$variables) {
else {
$variables['classes_array'][] = 'no-sidebars';
}
-
+
// Populate the body classes.
if ($suggestions = template_page_suggestions(arg(), 'page')) {
foreach ($suggestions as $suggestion) {
@@ -2151,7 +2157,7 @@ function template_preprocess_html(&$variables) {
}
}
}
-
+
// If on an individual node page, add the node type to body classes.
if ($node = menu_get_object()) {
$variables['classes_array'][] = drupal_html_class('node-type-' . $node->type);
@@ -2183,7 +2189,7 @@ function template_preprocess_html(&$variables) {
}
}
$variables['head_title'] = implode(' | ', $head_title);
-
+
// Populate the page template suggestions.
if ($suggestions = template_page_suggestions(arg(), 'html')) {
$variables['template_files'] = $suggestions;