From 54d08f99e85349eb5ee630d318560342e086057a Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Wed, 16 Sep 2015 15:31:41 +0200 Subject: [PATCH] DashboardPane: Order dashlets alphabetically refs #5600 --- .../Icinga/Web/Navigation/DashboardPane.php | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/library/Icinga/Web/Navigation/DashboardPane.php b/library/Icinga/Web/Navigation/DashboardPane.php index 200287668..e598a0508 100644 --- a/library/Icinga/Web/Navigation/DashboardPane.php +++ b/library/Icinga/Web/Navigation/DashboardPane.php @@ -33,11 +33,21 @@ class DashboardPane extends NavigationItem /** * Return this pane's dashlets * + * @param bool $order Whether to order the dashlets first + * * @return array */ - public function getDashlets() + public function getDashlets($order = true) { - return $this->dashlets ?: array(); + if ($this->dashlets === null) { + return array(); + } + + if ($order) { + ksort($this->dashlets); + } + + return $this->dashlets; } /** @@ -56,8 +66,8 @@ class DashboardPane extends NavigationItem parent::merge($item); $this->setDashlets(array_merge( - $this->getDashlets(), - $item->getDashlets() + $this->getDashlets(false), + $item->getDashlets(false) )); } }