highlight menus on sub-pages (#1220)

This commit is contained in:
Kevin Papst
2019-11-07 11:19:10 +01:00
committed by GitHub
parent 140fa4b7c0
commit 0705c26513
3 changed files with 69 additions and 39 deletions

View File

@@ -10,6 +10,7 @@
namespace App\EventSubscriber;
use App\Event\ConfigureMainMenuEvent;
use App\Utils\MenuItemModel as KimaiMenuItemModel;
use KevinPapst\AdminLTEBundle\Event\SidebarMenuEvent;
use KevinPapst\AdminLTEBundle\Model\MenuItemModel;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
@@ -104,6 +105,13 @@ class MenuBuilderSubscriber implements EventSubscriberInterface
} else {
if ($item->getRoute() == $route) {
$item->setIsActive(true);
continue;
}
if ($item instanceof KimaiMenuItemModel) {
if ($item->isChildRoute($route)) {
$item->setIsActive(true);
continue;
}
}
}
}