MDL-85193 course: Fix restore of backups with missing activity plugins

Show debugging instead of throwing an error when fetching an activity
icon from a missing activity plugin.
This commit is contained in:
Jun Pataleta
2025-05-07 18:10:25 +08:00
parent 69b36a36b4
commit 0c8e1b6256
+7 -1
View File
@@ -17,6 +17,7 @@
namespace core_course\output;
use core\component;
use core\exception\coding_exception;
use core\output\local\properties\iconsize;
use core\output\renderable;
use core\output\renderer_base;
@@ -63,7 +64,12 @@ class activity_icon implements renderable, templatable {
/** @var string the module name */
protected string $modname,
) {
$this->isbranded = component_callback('mod_' . $this->modname, 'is_branded', [], false) ? true : false;
try {
$this->isbranded = component_callback('mod_' . $this->modname, 'is_branded', [], false);
} catch (coding_exception $e) {
debugging($e->getMessage(), DEBUG_DEVELOPER);
$this->isbranded = false;
}
$this->purpose = plugin_supports('mod', $this->modname, FEATURE_MOD_PURPOSE, MOD_PURPOSE_OTHER);
}