. **/ class CLabel extends CTag { private bool $has_asterisk = false; public function __construct($label, $id = null) { parent::__construct('label', true, $label); $this->setFor($id); } public function setFor($id): self { if ($id !== null) { $this->setAttribute('for', zbx_formatDomId($id)); } return $this; } /** * Allow to add visual 'asterisk' mark to label. * * @param bool $has_asterisk Define is label marked with asterisk or not. * * @return CLabel */ public function setAsteriskMark(bool $has_asterisk = true): self { $this->has_asterisk = $has_asterisk; return $this; } public function toString($destroy = true) { if ($this->has_asterisk) { $this->addClass(ZBX_STYLE_FIELD_LABEL_ASTERISK); } return parent::toString($destroy); } }