diff options
Diffstat (limited to 'ui/include/classes/html/CLabel.php')
-rw-r--r-- | ui/include/classes/html/CLabel.php | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/ui/include/classes/html/CLabel.php b/ui/include/classes/html/CLabel.php index 513dfe94eb0..ab41f1493fc 100644 --- a/ui/include/classes/html/CLabel.php +++ b/ui/include/classes/html/CLabel.php @@ -21,12 +21,18 @@ class CLabel extends CTag { - public function __construct($label, $for = null) { + public function __construct($label, $id = null) { parent::__construct('label', true, $label); - if ($for !== null) { - $this->setAttribute('for', zbx_formatDomId($for)); + $this->setFor($id); + } + + public function setFor($id): self { + if ($id !== null) { + $this->setAttribute('for', zbx_formatDomId($id)); } + + return $this; } /** |