MOBILE-3833 siteplugins: Use new icon function

main
Pau Ferrer Ocaña 2022-04-08 16:17:47 +02:00
parent 72c516b88c
commit 6af2141284
1 changed files with 4 additions and 11 deletions

View File

@ -63,18 +63,18 @@ export class CoreSitePluginsModuleHandler extends CoreSitePluginsBaseHandler imp
/** /**
* @inheritdoc * @inheritdoc
*/ */
getData( async getData(
module: CoreCourseModuleData, module: CoreCourseModuleData,
courseId: number, courseId: number,
sectionId?: number, sectionId?: number,
forCoursePage?: boolean, forCoursePage?: boolean,
): CoreCourseModuleHandlerData { ): Promise<CoreCourseModuleHandlerData> {
if (this.shouldOnlyDisplayDescription(module, forCoursePage)) { if (this.shouldOnlyDisplayDescription(module, forCoursePage)) {
const title = module.description; const title = module.description;
module.description = ''; module.description = '';
return { return {
icon: this.getIconSrc(), icon: await CoreCourse.getModuleIconSrc(module.modname, this.handlerSchema.displaydata?.icon),
title: title || '', title: title || '',
a11yTitle: '', a11yTitle: '',
class: this.handlerSchema.displaydata?.class, class: this.handlerSchema.displaydata?.class,
@ -85,7 +85,7 @@ export class CoreSitePluginsModuleHandler extends CoreSitePluginsBaseHandler imp
const showDowloadButton = this.handlerSchema.downloadbutton; const showDowloadButton = this.handlerSchema.downloadbutton;
const handlerData: CoreCourseModuleHandlerData = { const handlerData: CoreCourseModuleHandlerData = {
title: module.name, title: module.name,
icon: this.getIconSrc(), icon: await CoreCourse.getModuleIconSrc(module.modname, this.handlerSchema.displaydata?.icon),
class: this.handlerSchema.displaydata?.class, class: this.handlerSchema.displaydata?.class,
showDownloadButton: showDowloadButton !== undefined ? showDowloadButton : hasOffline, showDownloadButton: showDowloadButton !== undefined ? showDowloadButton : hasOffline,
}; };
@ -198,13 +198,6 @@ export class CoreSitePluginsModuleHandler extends CoreSitePluginsBaseHandler imp
} }
} }
/**
* @inheritdoc
*/
getIconSrc(): string | undefined {
return this.handlerSchema.displaydata?.icon;
}
/** /**
* @inheritdoc * @inheritdoc
*/ */