Skip to content

Commit

Permalink
List Activate Bug Fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
cesurapp committed May 6, 2019
1 parent f6e8350 commit 37c9889
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions Builder/ItemProcess.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ private function recursiveProcess(ItemInterface $menu, $options)
{
// Get Child Menus
$childs = $menu->getChild();
$listActive = false;

// Parent Menu Route
if (isset($menu->getChildAttr()['data-parent'])) {
Expand All @@ -97,7 +98,8 @@ private function recursiveProcess(ItemInterface $menu, $options)

// Sort Current Child
foreach ($childs as $child) {
$active = false;
$childActive = false;

// Set Child Process
if ($child->getChild()) {
// Set Menu Depth
Expand All @@ -109,18 +111,18 @@ private function recursiveProcess(ItemInterface $menu, $options)
// Set Child List Class
$child->setChildAttr(array_merge_recursive($child->getChildAttr(), ['class' => 'menu_level_' . $child->getLevel()]));

$active = $this->recursiveProcess($child, $options);
$childActive = $this->recursiveProcess($child, $options);
}

// Generate Route Link
if ($child->getRoute()) {
$child->setLink($this->router->generate($child->getRoute()['name'], $child->getRoute()['params']));
}

// Link Active Class
if (($this->currentUri === $child->getLink()) || $active) {
$active = true;
$child->setListAttr(array_merge_recursive($child->getListAttr(), ['class' => $options['currentClass']]));
}
// Link Active Class
if ($this->currentUri === $child->getLink() || $childActive) {
$listActive = true;
$child->setListAttr(array_merge_recursive($child->getListAttr(), ['class' => $options['currentClass']]));
}

// Item Security
Expand All @@ -138,6 +140,6 @@ private function recursiveProcess(ItemInterface $menu, $options)

// Set Childs
$menu->setChild($childs);
return $active;
return $listActive;
}
}
}

0 comments on commit 37c9889

Please sign in to comment.