Create a checkboxes input field.

@param  string  $name
@param  array  $list
@param  bool|array  $checked
@param  array  $options
@param  string  $separator

@return string
494691
public function checkboxes($name, array $list = [], $checked = null, array $options = [], $separator = '<br>')
    {
        $group = [];
        $name = \str_replace('[]', '', $name);

        foreach ($list as $id => $label) {
            $group[] = $this->generateCheckboxByGroup($id, $label, $name, $checked, $options);
        }

        return \implode($separator, $group);
    }
848019
public static function getValidator($name, $options = array())
    {
        $returnValue = null;

        
		
		$clazz = 'tao_helpers_form_validators_'.$name;
		if(class_exists($clazz)){
			$returnValue = new $clazz($options);
		} else {
			common_Logger::w('Unknown validator '.$name, array('TAO', 'FORM'));
		}
		
        

        return $returnValue;
    }
981524
public static function checkbox(
        $name,
        $value,
        array $checkedValues = [],
        array $htmlOptions = []
    ) {
        $check = self::input('checkbox', $name, $value);
        if (in_array($value, $checkedValues)) {
            $check .= ' checked="checked"';
        }
        $check .= self::htmlOptions($htmlOptions) .'>';
        return $check;
    }
857605
public function checkbox($name, $label = null, $value = 1, $checked = null, array $options = [])
    {
        $inputElement = $this->checkboxElement($name, $label, $value, $checked, false, $options);

        $wrapperOptions = $this->isHorizontal() ? ['class' => implode(' ', [$this->getLeftColumnOffsetClass(), $this->getRightColumnClass()])] : [];
        $wrapperElement = '<div' . $this->html->attributes($wrapperOptions) . '>' . $inputElement . $this->getFieldError($name) . $this->getHelpText($name, $options) . '</div>';

        return $this->getFormGroup($name, null, $wrapperElement);
    }
747987
def create_checkbox(self, name, margin=10):
        
        chk_btn = Gtk.CheckButton(name)
        chk_btn.set_margin_right(margin)
        return chk_btn
46564
public static function radioListSmart($name, $selection = null, $items = [], $options = [])
    {
        $encode = !isset($options['encode']) || $options['encode'];
        $formatter = isset($options['item']) ? $options['item'] : null;
        $itemOptions = isset($options['itemOptions']) ? $options['itemOptions'] : [];
        $lines = [];
        $index = 0;
        foreach ($items as $value => $label) {
            $checked = $selection !== null && (!is_array($selection) && !strcmp($value, $selection) || is_array($selection) && in_array($value, $selection));
            if ($formatter !== null) {
                $lines[] = call_user_func($formatter, $index, $label, $name, $checked, $value);
            } else {
                $lines[] = static::radioSmart($name, $checked, array_merge($itemOptions, ['value' => $value, 'label' => $encode ? static::encode($label) : $label]));
            }
            $index++;
        }
        $separator = isset($options['separator']) ? $options['separator'] : "\n";
        if (isset($options['unselect'])) {
            // add a hidden field so that if the list box has no option being selected, it still submits a value
            $hidden = static::hiddenInput($name, $options['unselect']);
        } else {
            $hidden = '';
        }
        $tag = isset($options['tag']) ? $options['tag'] : 'div';
        unset($options['tag'], $options['unselect'], $options['encode'], $options['separator'], $options['item'], $options['itemOptions']);
        $columns = (int)ArrayHelper::remove($options, 'columns');
        if ($columns > 0 && $columns < 12) {
            static::addCssClass($options, 'row');
            $col = round(12 / $columns);
            $sep = count($lines) / $columns;
            $i = 0;
            $return = '<div class="col col-' . $col . '">';
            foreach ($lines as $line) {
                if ($i >= $sep) {
                    $return .= '</div><div class="col col-' . $col . '">';
                    $i = 0;
                }
                $i++;
                $return .= $line . $separator;
            }
            $return .= '</div>';
        } else {
            $return = implode($separator, $lines);
        }
        return $hidden . static::tag($tag, $return, $options);
    }
486888
protected function createCheckbox($name, $options)
    {
        $box = new Checkbox($name, $options);
        $box->setAttribute('checked', true)
            ->setAttribute(
                'id',
                preg_replace(
                    array('~\[~', '~\]~', '~--+~', '~-$~'),
                    array('-', '', '-', ''),
                    $name
                )
            );

        return $box;
    }
259684
public function radio($name, $label = null, $value = null, $checked = null, array $options = [])
    {
        $inputElement = $this->radioElement($name, $label, $value, $checked, false, $options);

        $wrapperOptions = $this->isHorizontal() ? ['class' => implode(' ', [$this->getLeftColumnOffsetClass(), $this->getRightColumnClass()])] : [];
        $wrapperElement = '<div' . $this->html->attributes($wrapperOptions) . '>' . $inputElement . '</div>';

        return $this->getFormGroup(null, $label, $wrapperElement);
    }
912878
public function checkbox(
        $name,
        $value = 1,
        $checked = null,
        $options = []
    ) {
        $checkable = parent::checkbox($name, $value, $checked, $options);

        return array_key_exists('label', $options) ?
            $this->wrapCheckable($options['label'], 'checkbox', $checkable) :
            $checkable;
    }
72303
public function nestedList(array $list, array $options = [], array $itemOptions = [])
    {
        $options = optionsParser($options);
        $itemOptions = optionsParser($itemOptions);

        if ($options->exists('icon')) {
            $itemOptions->add('icon', $options->get('icon'));
        }

        if ($itemOptions->exists('icon')) {
            $options->append('class', 'fa-ul');
            $itemOptions->append('icon', 'li');

            $list = array_map(function ($element) use ($itemOptions) {
                return collection($this->addIconToText($element, clone $itemOptions))->first();
            }, $list);
        }

        $options->delete('icon', 'icon-align');
        $itemOptions->delete('icon', 'icon-align');

        return parent::nestedList($list, $options->toArray(), $itemOptions->toArray());
    }
272814
public static function select($name, $list = [], $selected = null, $options = [])
    {
        self::exclure($options, ['name']);
        //
        $options['name'] = $name;
        //
        $sub = '';
        //
        if (!empty($list)) {
            foreach ($list as $value) {
                $sub .= self::option($value, (!is_null($selected) && $value == $selected));
            }
        }
        //
        $options = Html::attributes($options);
        //
        return '<select'.$options.">\n".$sub."</select>\n";
    }
85119
public function checkbox($name = null, $value = null, $items = array()) 
	{
		Argument::i()
			->test(1, 'string', 'null')
			->test(2, 'scalar', 'array', 'null')
			->test(3, 'string', 'array');
		
		$field = Checkbox::i()->setItems($items);
		
		if(!is_null($name)) {
			$field->setName($name);
		}
		
		if(!is_null($value)) {
			$field->setValue($value);
		}
		
		return $field;
	}
847151
public static function activeCheckboxListSmartToggles($model, $attribute, $items, $options = [])
    {
        $options['itemOptions']['labelOptions'] = ['class' => 'toggle'];
        return static::activeListInput('checkboxListSmart', $model, $attribute, $items, $options);
    }
487945
static function checkBox($name, $bit, $attr = array(), $val = true)
    {
        if ($bit == "true" || $bit == 1)
            $attr["checked"] = "true";

        $attr = array_merge(
            array(
                "type" => "checkbox",
            ),
            $attr
        );

        self::input($name, $val, $attr);
    }
1230898
public function embed($name, array $value, $separator = '.', $merge = false)
    {
        if (isset($value['rules'])) {
            $this->rules = array_merge($this->rules, $value['rules']);
        }

        $name = $separator !== '.' ? str_replace($separator, '.', $name) : $name;

        if (isset($value['form'])) {
            $form = array_diff_key($value['form'], ['fields' => 1, 'field' => 1]);
        } else {
            $form = [];
        }

        $items = isset($this->items[$name]) ? $this->items[$name] : ['type' => '_root', 'form_field' => false];

        $this->items[$name] = $items;
        $this->addProperty($name);

        $prefix = $name ? $name . '.' : '';
        $params = array_intersect_key($form, $this->filter);
        $location = [$name];

        if (isset($value['form']['field'])) {
            $this->parseFormField($name, $value['form']['field'], $params, $prefix, '', $merge, $location);
        } elseif (isset($value['form']['fields'])) {
            $this->parseFormFields($value['form']['fields'], $params, $prefix, '', $merge, $location);
        }

        $this->items[$name] += ['form' => $form];

        return $this;
    }
28818
public function createForm($name, $type = "form", array $data = array(), array $options = array())
    {
        $options = array_merge(
            [
                "csrf_protection" => false,
            ],
            $options
        );

        return parent::createForm($name, $type, $data, $options);
    }
192400
private function option_checkbox($name, $on, $label) {
        if ($on) {
            $checked = ' checked="checked"';
        } else {
            $checked = '';
        }
        $name = 'userselector_' . $name;
        // For the benefit of brain-dead IE, the id must be different from the name of the hidden form field above.
        // It seems that document.getElementById('frog') in IE will return and element with name="frog".
        $output = '<div class="form-check"><input type="hidden" name="' . $name . '" value="0" />' .
                    '<label class="form-check-label" for="' . $name . 'id">' .
                        '<input class="form-check-input" type="checkbox" id="' . $name . 'id" name="' . $name .
                            '" value="1"' . $checked . ' /> ' . $label .
                    "</label>
                   </div>\n";
        user_preference_allow_ajax_update($name, PARAM_BOOL);
        return $output;
    }