From 321aa7c8ed0573ca3aaf51325de4ac3ddfaa49e0 Mon Sep 17 00:00:00 2001 From: dingyongliang Date: Tue, 7 Feb 2023 17:07:13 +0800 Subject: [PATCH] * zin: add checkbox. --- zin/wg/checkbox/v1.php | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 zin/wg/checkbox/v1.php diff --git a/zin/wg/checkbox/v1.php b/zin/wg/checkbox/v1.php new file mode 100644 index 0000000000..8f35957ca1 --- /dev/null +++ b/zin/wg/checkbox/v1.php @@ -0,0 +1,38 @@ + 'checkbox w-28'); + + static $customProps = 'text,checked'; + + static function create($props) + { + $checkbox = new checkbox(); + foreach($props as $key => $value) $checkbox->prop($key, $value); + return $checkbox; + } + + protected function build($isPrint = false, $parent = null) + { + $builder = parent::build($isPrint, $parent); + + $input = h5::input(set('type', 'checkbox')); + if ($this->prop('checked')) $input->append(set('checked', 'true')); + + $builder->append($input); + $builder->append($this->prop('text')); + + return $builder; + } +}