From 9ff0abd8d683ab5a285fcf70e27d1bcd1cbc47df Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Thu, 24 Dec 2015 15:34:50 +0100 Subject: Update active menu in sidebars --- app/Helper/App.php | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'app/Helper') diff --git a/app/Helper/App.php b/app/Helper/App.php index 6e6028fc..2015d896 100644 --- a/app/Helper/App.php +++ b/app/Helper/App.php @@ -12,6 +12,30 @@ use Kanboard\Core\Base; */ class App extends Base { + /** + * Make sidebar menu active + * + * @access public + * @param string $controller + * @param string $action + * @param string $plugin + * @return string + */ + public function checkMenuSelection($controller, $action = '', $plugin = '') + { + $result = strtolower($this->getRouterController()) === strtolower($controller); + + if ($result && $action !== '') { + $result = strtolower($this->getRouterAction()) === strtolower($action); + } + + if ($result && $plugin !== '') { + $result = strtolower($this->getPluginName()) === strtolower($plugin); + } + + return $result ? 'class="active"' : ''; + } + /** * Get plugin name from route * -- cgit v1.2.3