Skip to content

Commit

Permalink
Return a string when no submenu is present
Browse files Browse the repository at this point in the history
  • Loading branch information
Jurian Sluiman committed Apr 29, 2013
1 parent 2d2396a commit 3baaf27
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions src/Common/View/Helper/SubMenu.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,15 +109,16 @@ public function __toString()
// Reset the container
$menu->setContainer($current);

if (strlen($html)) {
$label = $this->header ?: $container->getLabel();

return sprintf('<ul%s><li%s><a href="%s">%s</a>%s</li></ul>',
(null !== $this->class) ? ' class="' . $this->class . '"' : null,
($container->isActive())? ' class="active"' : null,
$container->getHref(),
$label,
$html);
if (!strlen($html)) {
return '';
}

$label = $this->header ?: $container->getLabel();
return sprintf('<ul%s><li%s><a href="%s">%s</a>%s</li></ul>',
(null !== $this->class) ? ' class="' . $this->class . '"' : null,
($container->isActive())? ' class="active"' : null,
$container->getHref(),
$label,
$html);
}
}

0 comments on commit 3baaf27

Please sign in to comment.