From 6c2d3de6fe59c93688f28386f9c69c8cfa753be5 Mon Sep 17 00:00:00 2001 From: tianshujie Date: Mon, 24 Jul 2023 15:06:00 +0800 Subject: [PATCH] * Zin: add labelFor props for checkbox. --- lib/zin/wg/checkbox/v1.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/zin/wg/checkbox/v1.php b/lib/zin/wg/checkbox/v1.php index c1cb7af0e5..bf5c61e73d 100644 --- a/lib/zin/wg/checkbox/v1.php +++ b/lib/zin/wg/checkbox/v1.php @@ -16,6 +16,7 @@ class checkbox extends wg 'typeClass?: string', 'rootClass?: string', 'labelClass?: string', + 'labelFor?: string', ); public function onAddChild($child) @@ -29,7 +30,7 @@ class checkbox extends wg protected function buildPrimary() { - list($id, $text, $name, $checked, $disabled, $type, $typeClass, $rootClass, $labelClass, $value) = $this->prop(array('id', 'text', 'name', 'checked', 'disabled', 'type', 'typeClass', 'rootClass', 'labelClass', 'value')); + list($id, $text, $name, $checked, $disabled, $type, $typeClass, $rootClass, $labelClass, $labelFor, $value) = $this->prop(array('id', 'text', 'name', 'checked', 'disabled', 'type', 'typeClass', 'rootClass', 'labelClass', 'labelFor', 'value')); if(empty($typeClass)) $typeClass = $type; if(empty($id)) $id = $name . '_' . $value; @@ -43,11 +44,11 @@ class checkbox extends wg set::id($id), set::name($name), set::checked($checked), - set($this->props->skip('text,primary,typeClass,rootClass,id,labelClass')), + set($this->props->skip('text,primary,typeClass,rootClass,id,labelClass,labelFor')), ), h::label ( - set::for($id), + set::for($labelFor ? $labelFor : $id), setClass($labelClass), $text, ),