Set dashboard active if it is not disabled

This commit is contained in:
Marius Hein 2016-04-26 13:50:02 +02:00
parent 8461cfafd8
commit 6607af61e1
2 changed files with 31 additions and 2 deletions

View File

@ -17,6 +17,8 @@ class DashboardPane extends NavigationItem
*/
protected $dashlets;
protected $disabled;
/**
* Set this pane's dashlets
*
@ -72,4 +74,24 @@ class DashboardPane extends NavigationItem
$item->getDashlets(false)
));
}
/**
* Set disabled state for pane
*
* @param bool $disabled
*/
public function setDisabled($disabled=true)
{
$this->disabled = (bool) $disabled;
}
/**
* Get disabled state for pane
*
* @return bool
*/
public function getDisabled()
{
return $this->disabled;
}
}

View File

@ -373,8 +373,15 @@ class Dashboard extends AbstractWidget
*/
private function setDefaultPane()
{
reset($this->panes);
$active = key($this->panes);
$active = null;
foreach ($this->panes as $key=>$pane) {
if ($pane->getDisabled() === false) {
$active = $key;
break;
}
}
if ($active !== null) {
$this->activate($active);
}