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
This commit is contained in:
Johannes Meyer 2015-09-15 13:54:53 +02:00
parent 1d6ad6df21
commit ccae7c4d0d
1 changed files with 14 additions and 5 deletions

View File

@ -308,10 +308,13 @@ class Module
/** @var DashboardContainer $pane */ /** @var DashboardContainer $pane */
$navigation->addItem( $navigation->addItem(
$pane->getName(), $pane->getName(),
array_merge(
$pane->getProperties(),
array( array(
'type' => 'dashboard-pane', 'type' => 'dashboard-pane',
'dashlets' => $pane->getDashlets() 'dashlets' => $pane->getDashlets()
) )
)
); );
} }
@ -322,12 +325,18 @@ class Module
* Add or get a dashboard pane * Add or get a dashboard pane
* *
* @param string $name * @param string $name
* @param array $properties
* *
* @return DashboardContainer * @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]; return $this->paneItems[$name];
} }