Defaulted the main menu counter to sum it's side menu counters
This commit is contained in:
parent
d6f8cc179d
commit
b39eb03336
|
|
@ -312,13 +312,23 @@ class NavigationManager
|
|||
}
|
||||
|
||||
foreach ($this->items as $item) {
|
||||
if ($item->counter === false) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($item->counter !== null && is_callable($item->counter)) {
|
||||
$item->counter = call_user_func($item->counter, $item);
|
||||
} elseif (!empty($sideItems = $this->listSideMenuItems($item->owner, $item->code))) {
|
||||
$item->counter = 0;
|
||||
foreach ($sideItems as $sideItem) {
|
||||
$item->counter += $sideItem->counter;
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($item->counter)) {
|
||||
$item->counter = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $this->items;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue