'dashboard-settings']; protected $tag = 'div'; /** @var Dashboard */ protected $dashboard; public function __construct(Dashboard $dashboard) { $this->dashboard = $dashboard; } protected function assemble() { $activeHome = $this->dashboard->getActiveHome(); if (count($this->dashboard->getEntries()) === 1 && $activeHome->getName() === DashboardHome::DEFAULT_HOME) { $this->setAttribute('data-icinga-home', DashboardHome::DEFAULT_HOME); foreach ($activeHome->getEntries() as $pane) { $pane->setHome($activeHome); $this->addHtml(new DashboardList($pane)); } $url = Url::fromPath(Dashboard::BASE_ROUTE . '/new-pane') ->setParams(['home' => $activeHome->getName()]); $this->addHtml(new ActionLink(t('Add Dashboard'), $url, 'plus', [ 'class' => 'add-dashboard', 'data-icinga-modal' => true, 'data-no-icinga-ajax' => true ])); } else { // Make a list of dashboard homes foreach ($this->dashboard->getEntries() as $home) { if ($home->isDisabled()) { continue; } $this->addHtml(new DashboardHomeList($home)); } } } }