parent
675a130787
commit
db4c81a093
|
@ -191,6 +191,21 @@ class Pane extends UserWidget
|
|||
return implode("\n", $dashlets) . "\n";
|
||||
}
|
||||
|
||||
/**
|
||||
* Create, add and return a new dashlet
|
||||
*
|
||||
* @param string $title
|
||||
* @param string $url
|
||||
*
|
||||
* @return Dashlet
|
||||
*/
|
||||
public function createDashlet($title, $url = null)
|
||||
{
|
||||
$dashlet = new Dashlet($title, $url, $this);
|
||||
$this->addDashlet($dashlet);
|
||||
return $dashlet;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a dashlet to this pane, optionally creating it if $dashlet is a string
|
||||
*
|
||||
|
@ -206,7 +221,7 @@ class Pane extends UserWidget
|
|||
if ($dashlet instanceof Dashlet) {
|
||||
$this->dashlets[$dashlet->getTitle()] = $dashlet;
|
||||
} elseif (is_string($dashlet) && $url !== null) {
|
||||
$this->dashlets[$dashlet] = new Dashlet($dashlet, $url, $this);
|
||||
$this->createDashlet($dashlet, $url);
|
||||
} else {
|
||||
throw new ConfigurationError('Invalid dashlet added: %s', $dashlet);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue