From 5445d24a5770239bff8346d3a161a9bf8e73d72b Mon Sep 17 00:00:00 2001 From: Dani Palou Date: Tue, 19 Apr 2022 13:25:38 +0200 Subject: [PATCH] MOBILE-3833 siteplugins: Use theme icon if present for modules --- .../features/siteplugins/classes/handlers/module-handler.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/core/features/siteplugins/classes/handlers/module-handler.ts b/src/core/features/siteplugins/classes/handlers/module-handler.ts index 57b415309..5b90fbee7 100644 --- a/src/core/features/siteplugins/classes/handlers/module-handler.ts +++ b/src/core/features/siteplugins/classes/handlers/module-handler.ts @@ -69,12 +69,14 @@ export class CoreSitePluginsModuleHandler extends CoreSitePluginsBaseHandler imp sectionId?: number, forCoursePage?: boolean, ): Promise { + 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, };