Set dashboard active if it is not disabled
This commit is contained in:
parent
8461cfafd8
commit
6607af61e1
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue