From cc8ed1755d96355763a06e5bed443505fe7ddf9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edi=20Modri=C4=87?= Date: Fri, 24 Apr 2020 11:18:54 +0200 Subject: [PATCH] Add menu_item_location property to menu items --- bundle/Menu/Factory/LocationFactory.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/bundle/Menu/Factory/LocationFactory.php b/bundle/Menu/Factory/LocationFactory.php index e8feef84..1ab93a2f 100644 --- a/bundle/Menu/Factory/LocationFactory.php +++ b/bundle/Menu/Factory/LocationFactory.php @@ -52,7 +52,11 @@ public function createItem($name, array $options = []): ItemInterface $menuItem ->setLabel($options['ezlocation']->content->name) - ->setExtra('ezlocation', $options['ezlocation']); + ->setExtra('ezlocation', $options['ezlocation']) + // Used to preserve the reference to the original menu item location + // (e.g. in case of menu item or shortcut where ezlocation will be overwritten + // by the location of related content) + ->setExtra('menu_item_location', $options['ezlocation']); $extension = $this->getExtension($options['ezlocation']); $extension->buildItem($menuItem, $options['ezlocation']);