diff options
author | Simon Rettberg | 2019-03-26 12:04:35 +0100 |
---|---|---|
committer | Simon Rettberg | 2019-03-26 12:04:35 +0100 |
commit | 82e546cfa47dbc7d5d7a780c92129a871087ee12 (patch) | |
tree | b55719f148afde911c0056799441639f049aef6d /inc/dashboard.inc.php | |
parent | [serversetup-bwlp-ipxe] Fix: Autoboot not working for chained menus (diff) | |
download | slx-admin-82e546cfa47dbc7d5d7a780c92129a871087ee12.tar.gz slx-admin-82e546cfa47dbc7d5d7a780c92129a871087ee12.tar.xz slx-admin-82e546cfa47dbc7d5d7a780c92129a871087ee12.zip |
[inc/Dashboard] Add feature to collapse sections in sidebar mode
Modules can now declare that they should be collapsed by default. If a
menu category only contains such modules, it will be collapsed in the
sidebar mode of the menu.
Diffstat (limited to 'inc/dashboard.inc.php')
-rw-r--r-- | inc/dashboard.inc.php | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/inc/dashboard.inc.php b/inc/dashboard.inc.php index d576a8f1..0b0f69e3 100644 --- a/inc/dashboard.inc.php +++ b/inc/dashboard.inc.php @@ -42,6 +42,7 @@ class Dashboard $currentPage = Page::getModule()->getIdentifier(); $categories = array(); foreach ($modByCategory as $catId => $modList) { + $collapse = true; /* @var Module[] $modList */ $modules = array(); foreach ($modList as $modId => $module) { @@ -54,13 +55,18 @@ class Dashboard if ($module->getIdentifier() === $currentPage) { $newEntry['className'] = 'active'; $newEntry['subMenu'] = self::$subMenu; + $collapse = false; // Don't collapse category if it contains the active module + } + if (!$module->doCollapse()) { + $collapse = false; } $modules[] = $newEntry; } $categories[] = array( 'icon' => self::getCategoryIcon($catId), 'displayName' => Dictionary::getCategoryName($catId), - 'modules' => $modules + 'modules' => $modules, + 'collapse' => $collapse, ); } Render::setDashboard(array( |