From 32716ee88a5e6bacaf2eaf0af7e2e373c37ff17e Mon Sep 17 00:00:00 2001 From: Alfonso Salces Date: Mon, 23 Jan 2023 11:20:38 +0100 Subject: [PATCH] MOBILE-4238 Siteplugins: Filter text for collapsible title --- .../pages/module-index/module-index.ts | 26 ++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/src/core/features/siteplugins/pages/module-index/module-index.ts b/src/core/features/siteplugins/pages/module-index/module-index.ts index 0dccf03fe..053eb374f 100644 --- a/src/core/features/siteplugins/pages/module-index/module-index.ts +++ b/src/core/features/siteplugins/pages/module-index/module-index.ts @@ -19,6 +19,9 @@ import { CoreCourseModuleData } from '@features/course/services/course-helper'; import { CanLeave } from '@guards/can-leave'; import { CoreNavigator } from '@services/navigator'; import { CoreSitePluginsModuleIndexComponent } from '../../components/module-index/module-index'; +import { CoreSites } from '@services/sites'; +import { CoreFilterFormatTextOptions } from '@features/filter/services/filter'; +import { CoreFilterHelper } from '@features/filter/services/filter-helper'; /** * Page to render the index page of a module site plugin. @@ -38,10 +41,31 @@ export class CoreSitePluginsModuleIndexPage implements OnInit, CanLeave { /** * @inheritdoc */ - ngOnInit(): void { + async ngOnInit(): Promise { this.title = CoreNavigator.getRouteParam('title'); this.module = CoreNavigator.getRouteParam('module'); this.courseId = CoreNavigator.getRouteNumberParam('courseId'); + + if (this.title) { + const siteId = CoreSites.getCurrentSiteId(); + + const options: CoreFilterFormatTextOptions = { + clean: false, + courseId: this.courseId, + wsNotFiltered: false, + singleLine: true, + }; + + const filteredTitle = await CoreFilterHelper.getFiltersAndFormatText( + this.title.trim(), + 'module', + this.module?.id ?? -1, + options, + siteId, + ); + + this.title = filteredTitle.text; + } } /**