MDL-56673 templatelibrary: return false when core template doesn't exist

This commit is contained in:
Dan Poltawski
2016-11-01 10:18:17 +00:00
parent 577bd70d38
commit 840ba76c0c
2 changed files with 4 additions and 3 deletions
+3 -2
View File
@@ -111,7 +111,7 @@ class api {
*
* @param string $component The component that holds the template.
* @param string $template The name of the template.
* @return string the template
* @return string the template or false if template doesn't exist.
*/
public static function load_canonical_template($component, $template) {
// Get the list of possible template directories.
@@ -133,7 +133,8 @@ class api {
}
if ($filename === false) {
throw new moodle_exception('filenotfound', 'error');
// There are occasions where we don't have a core template.
return false;
}
$templatestr = file_get_contents($filename);