MOBILE-3833 siteplugins: Use theme icon if present for modules

main
Dani Palou 2022-04-19 13:25:38 +02:00
parent 63bc43ceb4
commit 5445d24a57
1 changed files with 4 additions and 2 deletions

View File

@ -69,12 +69,14 @@ export class CoreSitePluginsModuleHandler extends CoreSitePluginsBaseHandler imp
sectionId?: number,
forCoursePage?: boolean,
): Promise<CoreCourseModuleHandlerData> {
const icon = module.modicon || this.handlerSchema.displaydata?.icon; // Prioritize theme icon over handler icon.
if (this.shouldOnlyDisplayDescription(module, forCoursePage)) {
const title = module.description;
module.description = '';
return {
icon: await CoreCourse.getModuleIconSrc(module.modname, this.handlerSchema.displaydata?.icon),
icon: await CoreCourse.getModuleIconSrc(module.modname, icon),
title: title || '',
a11yTitle: '',
class: this.handlerSchema.displaydata?.class,
@ -85,7 +87,7 @@ export class CoreSitePluginsModuleHandler extends CoreSitePluginsBaseHandler imp
const showDowloadButton = this.handlerSchema.downloadbutton;
const handlerData: CoreCourseModuleHandlerData = {
title: module.name,
icon: await CoreCourse.getModuleIconSrc(module.modname, this.handlerSchema.displaydata?.icon),
icon: await CoreCourse.getModuleIconSrc(module.modname, icon),
class: this.handlerSchema.displaydata?.class,
showDownloadButton: showDowloadButton !== undefined ? showDowloadButton : hasOffline,
};