Skip to content

Commit

Permalink
[BUGFIX] Strpos() empty needle exception
Browse files Browse the repository at this point in the history
  • Loading branch information
tbreuss committed Nov 11, 2014
1 parent 32ffd8d commit 30bd4a2
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/Menu/Page/Renderer/HtmlTree.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,12 +132,15 @@ private function getTemplate($key)
*/
private function addCssClasses($beginCurrent, $route)
{
$menuItem = $this->getMenuItem();
$cssClasses = [];
if($route == $this->getMenuItem()->route) {
if($route == $menuItem->route) {
$cssClasses[] = 'current';
}
if(strpos($route, $this->getMenuItem()->route) === 0) {
$cssClasses[] = 'active';
if(!empty($menuItem->route)) {
if(strpos($route, $menuItem->route) === 0) {
$cssClasses[] = 'active';
}
}
if(!empty($cssClasses)) {
$classString = sprintf(' class="%s"', implode(' ', $cssClasses));
Expand Down

0 comments on commit 30bd4a2

Please sign in to comment.