mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-27 07:44:04 +02:00
parent
675a130787
commit
db4c81a093
@ -191,6 +191,21 @@ class Pane extends UserWidget
|
|||||||
return implode("\n", $dashlets) . "\n";
|
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
|
* 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) {
|
if ($dashlet instanceof Dashlet) {
|
||||||
$this->dashlets[$dashlet->getTitle()] = $dashlet;
|
$this->dashlets[$dashlet->getTitle()] = $dashlet;
|
||||||
} elseif (is_string($dashlet) && $url !== null) {
|
} elseif (is_string($dashlet) && $url !== null) {
|
||||||
$this->dashlets[$dashlet] = new Dashlet($dashlet, $url, $this);
|
$this->createDashlet($dashlet, $url);
|
||||||
} else {
|
} else {
|
||||||
throw new ConfigurationError('Invalid dashlet added: %s', $dashlet);
|
throw new ConfigurationError('Invalid dashlet added: %s', $dashlet);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user