MDL-78427 core_theme: Add theme usage report and icon

In addition to adding in theme usage reports, there is also the
addition of an icon on the theme cards which takes you to the report.
This icon only appears for that theme if it has been used in any
overriding context.
This commit is contained in:
David Woloszyn 2024-01-24 12:15:21 +11:00
parent f30110b5eb
commit 40d397ab5f
24 changed files with 1157 additions and 10 deletions

View file

@ -628,6 +628,14 @@ class core_course_category implements renderable, cacheable_object, IteratorAggr
fix_course_sortorder();
}
// Delete theme usage cache if the theme has been changed.
if (isset($data->theme)) {
$oldcategory = $DB->get_record('course_categories', ['id' => $data->id]);
if ($data->theme != $oldcategory->theme) {
theme_delete_used_in_context_cache($data->theme, (string)$oldcategory->theme);
}
}
$newcategory->timemodified = time();
$categorycontext = $this->get_context();