From ccae7c4d0d959eb7fb691f20414885d377808964 Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Tue, 15 Sep 2015 13:54:53 +0200 Subject: [PATCH] Module: Allow to define a dashboard pane's properties Since dashboards are now alphabetically sorted as well, we need some way to affect this as the old behaviour was to sort them as they were registered refs #5600 --- library/Icinga/Application/Modules/Module.php | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/library/Icinga/Application/Modules/Module.php b/library/Icinga/Application/Modules/Module.php index 911fd058c..29a3b78dc 100644 --- a/library/Icinga/Application/Modules/Module.php +++ b/library/Icinga/Application/Modules/Module.php @@ -308,9 +308,12 @@ class Module /** @var DashboardContainer $pane */ $navigation->addItem( $pane->getName(), - array( - 'type' => 'dashboard-pane', - 'dashlets' => $pane->getDashlets() + array_merge( + $pane->getProperties(), + array( + 'type' => 'dashboard-pane', + 'dashlets' => $pane->getDashlets() + ) ) ); } @@ -322,12 +325,18 @@ class Module * Add or get a dashboard pane * * @param string $name + * @param array $properties * * @return DashboardContainer */ - protected function dashboard($name) + protected function dashboard($name, array $properties = array()) { - $this->paneItems[$name] = new DashboardContainer($name); + if (array_key_exists($name, $this->paneItems)) { + $this->paneItems[$name]->setProperties($properties); + } else { + $this->paneItems[$name] = new DashboardContainer($name, $properties); + } + return $this->paneItems[$name]; }