DashboardContainer: Allow to define a priority for dashlets

refs #3931
This commit is contained in:
Johannes Meyer 2019-09-09 14:42:16 +02:00
parent c3603c991d
commit d4dc282ac8
2 changed files with 10 additions and 5 deletions

View File

@ -43,12 +43,16 @@ class DashboardContainer extends NavigationItemContainer
*
* @param string $name
* @param string $url
* @param int $priority
*
* @return $this
*/
public function add($name, $url)
public function add($name, $url, $priority = null)
{
$this->dashlets[$name] = $url;
$this->dashlets[$name] = [
'url' => $url,
'priority' => $priority
];
return $this;
}
}

View File

@ -315,10 +315,11 @@ class Module
foreach ($panes as $pane) {
/** @var DashboardContainer $pane */
$dashlets = [];
foreach ($pane->getDashlets() as $dashletName => $dashletUrl) {
foreach ($pane->getDashlets() as $dashletName => $dashletConfig) {
$dashlets[$dashletName] = [
'label' => $this->translate($dashletName),
'url' => $dashletUrl
'label' => $this->translate($dashletName),
'url' => $dashletConfig['url'],
'priority' => $dashletConfig['priority']
];
}