addClass(self::ZBX_STYLE_COLLAPSIBLE); } public function setExpanded(bool $expanded = true): self { $this->is_expanded = $expanded; return $this; } protected function makeLegend(): string { return (new CTag('legend', true, (new CSimpleButton(new CSpan($this->caption))) ->addClass(self::ZBX_STYLE_TOGGLE) ->addClass($this->is_expanded ? ZBX_ICON_CHEVRON_UP : ZBX_ICON_CHEVRON_DOWN) ->setTitle($this->is_expanded ? _('Collapse') : _('Expand')) ))->toString(); } public function toString($destroy = true): string { if (!$this->is_expanded) { $this->addClass(self::ZBX_STYLE_COLLAPSED); } return parent::toString($destroy); } }