Popover menu: Fix JS widget instantiation, now done automatically but the UIBlock system

This commit is contained in:
Molkobain
2021-03-19 23:43:28 +01:00
parent 86c614d56d
commit e8656e8504
3 changed files with 3 additions and 5 deletions

View File

@@ -37,8 +37,7 @@ class PopoverMenu extends UIBlock
// Overloaded constants
public const BLOCK_CODE = 'ibo-popover-menu';
public const DEFAULT_HTML_TEMPLATE_REL_PATH = 'base/components/popover-menu/layout';
// TODO 3.0.0: Fix crash when enabling the JS template
//public const DEFAULT_JS_TEMPLATE_REL_PATH = 'base/components/popover-menu/layout';
public const DEFAULT_JS_TEMPLATE_REL_PATH = 'base/components/popover-menu/layout';
public const DEFAULT_JS_FILES_REL_PATH = [
'js/components/popover-menu.js',
];

View File

@@ -49,11 +49,11 @@ class PopoverMenuFactory
public static function MakeUserMenuForNavigationMenu()
{
$oMenu = new PopoverMenu('ibo-navigation-menu--user-menu');
$oMenu->SetTogglerJSSelector('[data-role="ibo-navigation-menu--user-menu--toggler"]');
// Allowed portals
$aAllowedPortalsItems = static::PrepareAllowedPortalsItemsForUserMenu();
if(!empty($aAllowedPortalsItems))
{
if (!empty($aAllowedPortalsItems)) {
$oMenu->AddSection('allowed_portals')
->SetItems('allowed_portals', $aAllowedPortalsItems);
}