Commit 9dda515b authored by webchick's avatar webchick

#412730 folllow-up by Crell: Move missing theme key notification to watchdog...

#412730 folllow-up by Crell: Move missing theme key notification to watchdog so that Drupal doesn't totally bomb out when theme function isn't found. (also fixes CLI installs)
parent 1c7bca0b
......@@ -37,12 +37,6 @@
* @} 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.
*
......@@ -768,7 +762,7 @@ function theme($hook, $variables = array()) {
}
if (!isset($hooks[$hook])) {
throw new ThemeHookNotFoundException(t('Theme hook "@hook" not found.', array('@hook' => $hook)));
watchdog('theme', 'Theme key "@key" not found.', array('@key' => $hook), WATCHDOG_WARNING);
}
$info = $hooks[$hook];
......
......@@ -50,23 +50,6 @@ class TemplateUnitTest extends DrupalWebTestCase {
$suggestions = array("page\0");
$this->assertEqual(drupal_discover_template(array('themes/garland'), $suggestions), 'themes/garland/page.tpl.php', t('Unsafe template suggestion fixed'));
}
/**
* Test that not-found theme hook throw a proper exception.
*/
function testThemeHookNotFound() {
try {
theme('this_does_not_exist');
$this->fail(t('Exception not thrown for invalid theme hook.'));
}
catch (ThemeHookNotFoundException $e) {
$this->assertEqual($e->getMessage(), t('Theme hook "this_does_not_exist" not found.'), t('Correct exception thrown with correct error message.'));
}
catch (Exception $e) {
$this->fail(t('Exception of type "@type" thrown instead of ThemeHookNotFoundException.', array('@type' => gettype($e))));
}
}
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment