MOBILE-4470 course: Add function to control if a module is on core
parent
8ae953515b
commit
58ef2f9e0e
|
@ -213,7 +213,7 @@ export class CoreModIconComponent implements OnInit, OnChanges {
|
|||
this.isLocalUrl = true;
|
||||
this.linkIconWithComponent = false;
|
||||
|
||||
const moduleName = !this.modname || CoreCourse.CORE_MODULES.indexOf(this.modname) < 0
|
||||
const moduleName = !this.modname || !CoreCourse.isCoreModule(this.modname)
|
||||
? fallbackModName
|
||||
: this.modname;
|
||||
|
||||
|
|
|
@ -137,7 +137,7 @@ export class CoreCourseProvider {
|
|||
|
||||
static readonly COMPONENT = 'CoreCourse';
|
||||
|
||||
readonly CORE_MODULES = [
|
||||
static readonly CORE_MODULES = [
|
||||
'assign', 'bigbluebuttonbn', 'book', 'chat', 'choice', 'data', 'feedback', 'folder', 'forum', 'glossary', 'h5pactivity',
|
||||
'imscp', 'label', 'lesson', 'lti', 'page', 'quiz', 'resource', 'scorm', 'survey', 'url', 'wiki', 'workshop',
|
||||
];
|
||||
|
@ -848,7 +848,7 @@ export class CoreCourseProvider {
|
|||
return mimetypeIcon;
|
||||
}
|
||||
|
||||
if (this.CORE_MODULES.indexOf(moduleName) < 0) {
|
||||
if (!CoreCourse.isCoreModule(moduleName)) {
|
||||
if (modicon) {
|
||||
return modicon;
|
||||
}
|
||||
|
@ -1324,6 +1324,17 @@ export class CoreCourseProvider {
|
|||
return !!module.url;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the module is a core module.
|
||||
*
|
||||
* @param moduleName The module name.
|
||||
* @returns Whether it's a core module.
|
||||
*/
|
||||
isCoreModule(moduleName: string): boolean {
|
||||
// If core modules are removed for a certain version we should check the version of the site.
|
||||
return CoreCourseProvider.CORE_MODULES.includes(moduleName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Wait for any course format plugin to load, and open the course page.
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue