From 01700dc155f56e2f3198a2cf98cccf2673fd4053 Mon Sep 17 00:00:00 2001 From: Manuel Transfeld Date: Mon, 8 Feb 2016 23:15:47 +0100 Subject: [PATCH] Allow parent of dropdown be a real link When changing the behaviour of the menu (eg. open on hover), it should be allowed for the parent of a dropdown to have a URI instead of forcing to `href="#"` Example: (--> About) http://vadikom.github.io/smartmenus/src/demo/index.html --- Menu/Factory/MenuDecorator.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Menu/Factory/MenuDecorator.php b/Menu/Factory/MenuDecorator.php index f9ea5adba..26daebb94 100644 --- a/Menu/Factory/MenuDecorator.php +++ b/Menu/Factory/MenuDecorator.php @@ -56,8 +56,11 @@ public function buildItem(ItemInterface $item, array $options) } if ($options['dropdown']) { + if ($item->getUri() == "") { + $item->setUri('#'); + } + $item - ->setUri('#') ->setAttribute('class', trim('dropdown '.$item->getAttribute('class'))) ->setLinkAttribute('class', 'dropdown-toggle') ->setLinkAttribute('data-toggle', 'dropdown')