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

@@ -0,0 +1,36 @@
<?php
/*
* This file is part of the Kimai time-tracking app.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace App\Utils;
use KevinPapst\AdminLTEBundle\Model\MenuItemModel as BaseMenuItemModel;
class MenuItemModel extends BaseMenuItemModel
{
private $childRoutes = [];
public function setChildRoutes(array $routes): MenuItemModel
{
$this->childRoutes = $routes;
return $this;
}
public function addChildRoute(string $route): MenuItemModel
{
$this->childRoutes[] = $route;
return $this;
}
public function isChildRoute(string $route): bool
{
return in_array($route, $this->childRoutes);
}
}