From 48645dd519b521433dac16984da40cfba8da3a89 Mon Sep 17 00:00:00 2001
From: Vincent Dumas <42336698+v-dumas@users.noreply.github.com>
Date: Fri, 23 Dec 2022 15:48:52 +0100
Subject: [PATCH] =?UTF-8?q?N=C2=B04852=20-=20Navigation=20menu:=20Display?=
=?UTF-8?q?=20"+"=20dict=20entries=20as=20a=20tooltip=20on=20sub-nodes=20(?=
=?UTF-8?q?#380)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
application/menunode.class.inc.php | 26 +++++++++++++------
.../navigation-menu/menu-node.html.twig | 6 ++---
2 files changed, 21 insertions(+), 11 deletions(-)
diff --git a/application/menunode.class.inc.php b/application/menunode.class.inc.php
index b4db18ae0..1ac728074 100644
--- a/application/menunode.class.inc.php
+++ b/application/menunode.class.inc.php
@@ -291,7 +291,17 @@ class ApplicationMenu
* @param string $sMenuGroupIdx
* @param array $aExtraParams
*
- * @return array
+ * @return array {
+ * array {
+ * sId: string,
+ * sTitle: string,
+ * sLabel: string,
+ * bHasCount: bolean,
+ * sUrl: string url
+ * bOpenInNewWindow: bolean
+ * aSubMenuNodes: same structure recursively
+ * }
+ * } $aSubMenuNodes
* @throws \DictExceptionMissingString
* @throws \Exception
* @since 3.0.0
@@ -320,12 +330,13 @@ class ApplicationMenu
}
$aSubMenuNodes[] = [
- 'sId' => $oSubMenuNode->GetMenuId(),
- 'sTitle' => $oSubMenuNode->GetTitle(),
- 'bHasCount' => $oSubMenuNode->HasCount(),
- 'sUrl' => $oSubMenuNode->GetHyperlink($aExtraParams),
+ 'sId' => $oSubMenuNode->GetMenuId(),
+ 'sTitle' => $oSubMenuNode->GetTitle(),
+ 'sLabel' => $oSubMenuNode->GetLabel(),
+ 'bHasCount' => $oSubMenuNode->HasCount(),
+ 'sUrl' => $oSubMenuNode->GetHyperlink($aExtraParams),
'bOpenInNewWindow' => $oSubMenuNode->IsHyperLinkInNewWindow(),
- 'aSubMenuNodes' => static::GetSubMenuNodes($sSubMenuItemIdx, $aExtraParams),
+ 'aSubMenuNodes' => static::GetSubMenuNodes($sSubMenuItemIdx, $aExtraParams),
];
}
@@ -746,7 +757,7 @@ abstract class MenuNode
}
/**
- * @return string
+ * @return string The "+" dictionary entry for this menu if exists, otherwise the Title (if we have a parent title, will output parentTitle / currentTitle)
*/
public function GetLabel()
{
@@ -758,7 +769,6 @@ abstract class MenuNode
} else {
$sRet = $this->GetTitle();
}
- //$sRet = $this->GetTitle();
}
return $sRet;
}
diff --git a/templates/base/layouts/navigation-menu/menu-node.html.twig b/templates/base/layouts/navigation-menu/menu-node.html.twig
index a998e47ef..482fa16e0 100644
--- a/templates/base/layouts/navigation-menu/menu-node.html.twig
+++ b/templates/base/layouts/navigation-menu/menu-node.html.twig
@@ -2,7 +2,7 @@
{% if aMenuNode.sUrl is not empty %}
{% set sTarget = (aMenuNode.bOpenInNewWindow == true) ? 'target="_blank"' : '' %}
{% else %}
{% endif %}
{% if aMenuNode.aSubMenuNodes is defined and aMenuNode.aSubMenuNodes|length > 0 %}
@@ -20,4 +20,4 @@
{% endfor %}
{% endif %}
-
\ No newline at end of file
+