diff --git a/admin/tool/templatelibrary/classes/api.php b/admin/tool/templatelibrary/classes/api.php index 23b7dcf793a..0d4f5c788e9 100644 --- a/admin/tool/templatelibrary/classes/api.php +++ b/admin/tool/templatelibrary/classes/api.php @@ -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); diff --git a/admin/tool/templatelibrary/classes/external.php b/admin/tool/templatelibrary/classes/external.php index be583a27a4e..2b5126c9d37 100644 --- a/admin/tool/templatelibrary/classes/external.php +++ b/admin/tool/templatelibrary/classes/external.php @@ -107,7 +107,7 @@ class external extends external_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, false if template doesn't exist. */ public static function load_canonical_template($component, $template) { $params = self::validate_parameters(self::load_canonical_template_parameters(),