MDL-77105 theme_boost: Add 'nofilter' class when necessary

Add the `.nofilter` class for activity icons when the icon URL's
`filtericon` parameter is not set, so they get rendered as they are on
the context header on the activity page.
This commit is contained in:
Jun Pataleta 2023-02-10 16:59:31 +08:00
parent 95d0e30eff
commit cf09a7f253

View File

@ -160,8 +160,13 @@ class core_renderer extends \core_renderer {
$heading = format_string($this->page->course->fullname, true, ['context' => $context]);
} else {
$heading = $this->page->cm->get_formatted_name();
$imagedata = html_writer::img($this->page->cm->get_icon_url()->out(false), '',
['class' => 'icon activityicon', 'aria-hidden' => 'true']);
$iconurl = $this->page->cm->get_icon_url();
$iconclass = $iconurl->get_param('filtericon') ? '' : 'nofilter';
$iconattrs = [
'class' => "icon activityicon $iconclass",
'aria-hidden' => 'true'
];
$imagedata = html_writer::img($iconurl->out(false), '', $iconattrs);
$purposeclass = plugin_supports('mod', $this->page->activityname, FEATURE_MOD_PURPOSE);
$purposeclass .= ' activityiconcontainer';
$purposeclass .= ' modicon_' . $this->page->activityname;