00001 <?php
00002
00003
00004
00005
00006
00007
00008 class InputWidgetCheckboxBase extends InputWidgetBase {
00009
00010
00011
00012 protected function extend_attributes(&$attrs, $params, $name, $title, $value, $policy) {
00013 $attrs['checked'] = $value ? 'checked' : false;
00014 }
00015
00016
00017
00018
00019 protected function render_input($attrs, $params, $name, $title, $value, $policy) {
00020 return
00021 html::input('hidden', $name, array('value' => 0)) .
00022 html::input('checkbox', $name, $attrs);
00023 }
00024
00025
00026
00027
00028 protected function render_label($widget, $html_attrs, $params, $name, $title, $value, $policy) {
00029 return parent::render_label($widget, $html_attrs, $params, $name, $title, $value, $policy | WidgetInput::WRAP_LABEL);
00030 }
00031 }