From 463ade4bf4143a4cd1e2e0dc668b08e05b9715b4 Mon Sep 17 00:00:00 2001 From: Romain Quetiez Date: Mon, 11 Jun 2012 16:21:03 +0000 Subject: [PATCH] Compiler: discard empty menu groups SVN:trunk[2090] --- setup/compiler.class.inc.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/setup/compiler.class.inc.php b/setup/compiler.class.inc.php index 79b056a76..bce8da8f1 100644 --- a/setup/compiler.class.inc.php +++ b/setup/compiler.class.inc.php @@ -122,13 +122,14 @@ class MFCompiler EOF; // Preliminary: determine parent menus not defined within the current module $aMenusToLoad = array(); - + $aParentMenus = array(); foreach($aMenusByModule[$sModuleName] as $sMenuId) { $oMenuNode = $aMenuNodes[$sMenuId]; if ($sParent = $oMenuNode->GetChildText('parent', null)) { $aMenusToLoad[] = $sParent; + $aParentMenus[] = $sParent; } // Note: the order matters: the parents must be defined BEFORE $aMenusToLoad[] = $sMenuId; @@ -137,6 +138,14 @@ EOF; foreach($aMenusToLoad as $sMenuId) { $oMenuNode = $aMenuNodes[$sMenuId]; + if ($oMenuNode->getAttribute("xsi:type") == 'MenuGroup') + { + if (!in_array($oMenuNode->getAttribute("id"), $aParentMenus)) + { + // Discard empty menu groups + continue; + } + } try { $sCompiledCode .= $this->CompileMenu($oMenuNode, $sRelativeDir, $oP);