/** * Add a dashlet to this pane, optionally creating it if $dashlet is a string * * @param string|Dashlet $dashlet The dashlet object or title * (if a new dashlet will be created) * @param string|null $url An Url to be used when dashlet is a string * * @return $this * @throws \Icinga\Exception\ConfigurationError */ public function addDashlet($dashlet, $url = null) { if ($dashlet instanceof Dashlet) { $this->dashlets[$dashlet->getTitle()] = $dashlet; } elseif (is_string($dashlet) && $url !== null) { $this->dashlets[$dashlet] = new Dashlet($dashlet, $url, $this); } else { throw new ConfigurationError('Invalid dashlet added: %s', $dashlet); } return $this; }
/** * @param Dashlet $dashlet */ public function load(Dashlet $dashlet) { $this->populate(array('pane' => $dashlet->getPane()->getName(), 'org_pane' => $dashlet->getPane()->getName(), 'dashlet' => $dashlet->getTitle(), 'org_dashlet' => $dashlet->getTitle(), 'url' => $dashlet->getUrl()->getRelativeUrl())); }