From 12d75f14b2fca7471ad2182970147ce08f9d1f8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pau=20Ferrer=20Oca=C3=B1a?= Date: Thu, 2 May 2019 11:59:22 +0200 Subject: [PATCH] MOBILE-2903 menu: Disable responsive menu items is set on site --- src/components/ion-tabs/core-ion-tabs.html | 2 +- src/core/mainmenu/providers/mainmenu.ts | 13 ++++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/components/ion-tabs/core-ion-tabs.html b/src/components/ion-tabs/core-ion-tabs.html index d662320ef..123d340c1 100644 --- a/src/components/ion-tabs/core-ion-tabs.html +++ b/src/components/ion-tabs/core-ion-tabs.html @@ -1,5 +1,5 @@
- +
diff --git a/src/core/mainmenu/providers/mainmenu.ts b/src/core/mainmenu/providers/mainmenu.ts index b6eeefc75..59eab0b7a 100644 --- a/src/core/mainmenu/providers/mainmenu.ts +++ b/src/core/mainmenu/providers/mainmenu.ts @@ -170,7 +170,7 @@ export class CoreMainMenuProvider { * @return {number} Number of items depending on the device width. */ getNumItems(): number { - if (window && window.innerWidth) { + if (!this.isResponsiveMainMenuItemsDisabledInCurrentSite() && window && window.innerWidth) { let numElements; if (this.tablet) { @@ -207,4 +207,15 @@ export class CoreMainMenuProvider { return tablet ? 'side' : 'bottom'; } + + /** + * Check if responsive main menu items is disabled in the current site. + * + * @return {boolean} Whether it's disabled. + */ + protected isResponsiveMainMenuItemsDisabledInCurrentSite(): boolean { + const site = this.sitesProvider.getCurrentSite(); + + return site && site.isFeatureDisabled('NoDelegate_ResponsiveMainMenuItems'); + } }