Create a checkbox input field.

@param string $name
@param mixed  $value
@param null   $selected
@param array  $attributes
@param array  $extra

@internal param bool $checked

@return string
559192
public function checkbox($name, $value = 1, $selected = null, array $attributes = array(), array $extra = array())
    {
        return $this->build('checkbox', $name, $selected, $attributes, $extra, $value);
    }
696326
public static function checkBox($name, $checked = false, $htmlOptions = array())
    {
        $label = TbArray::popValue('label', $htmlOptions, false);
        $labelOptions = TbArray::popValue('labelOptions', $htmlOptions, array());
        self::addCssClass('checkbox', $labelOptions);
        $input = parent::checkBox($name, $checked, $htmlOptions);
        return self::createCheckBoxAndRadioButtonLabel($label, $input, $labelOptions);
    }
1137472
public function select($name = null, $options = [], $value = null)
    {
        return Select::create()
            ->attributeIf($name, 'name', $this->fieldName($name))
            ->attributeIf($name, 'id', $this->fieldName($name))
            ->options($options)
            ->value($name ? $this->old($name, $value) : $value);
    }
270039
function( name, value, options, checked ) {
        options = options || {};
        if(checked) options.checked = "checked";
        return this.input_field_tag(name, value, 'checkbox', options);
    }
144556
public function select($name, $options = array(), $selected = null, array $attributes = array(), array $extra = array())
    {
        /**
         * Swap values so programmers can skip the $value argument
         * and pass the $attributes array directly.
         */
        if (is_array($selected) && empty($attributes)) {
            $extra = $attributes;
            $attributes = $selected;
            $selected = null;
        }

        return $this->doBuild('select', $name, $selected, $attributes, $extra, $options);
    }
413223
public function checkbox($name, $value = 1, $checked = null, array $options = [])
    {
        $field = $this->form->checkbox($name,
                                       $value,
                                       $checked,
                                       $this->getFieldOptions($name, $options));

        if ((bool)Arr::get($options, 'inline', false)) {
            return '<label class="checkbox-inline">' . $field . Arr::get($options, 'content', '') . '</label>';
        }

        return '<div class="checkbox"><label>' . $field . Arr::get($options, 'content', '') . '</label></div>';
    }
445802
public function input($name, $value = null, $attributes = null)
    {
        return '<input type="text" name="'.$name.'" value="'.$this->getValue($name, $value).'" '.(($attributes !== null) ? $this->attributes($attributes) : "").'/>';
    }
1130840
protected function renderCheckbox($name, $value, $options)
    {
        $options['tabindex'] = self::TABINDEX;

        if (!isset($options['label'])) {
            $options['label'] = '';
        }

        if (!array_key_exists('uncheck', $options)) {
            $options['uncheck'] = 0;
        }

        $input = Html::checkbox($name, $value, $options);

        return Html::tag('div', $input, ['class' => 'checkbox']);
    }
659317
public function file($name, array $attributes = array(), array $extra = array())
    {
        return $this->build('file', $name, null, $attributes, $extra);
    }
23554
public function input($name, $options = array())
    {
        $options += array(
            "type"  => "text",
            "id"    => $this->id($name),
            "name"  => $this->name($name),
            "error" => true,
            "class" => "",
            "value" => "",
            "label" => null
        );

        $currentValue = $this->getCurrentValue($options['name']);

        $errorHtml = "";
        $fieldHasErrors = false;

        if (!is_null($this->associatedEntity)) {
            // Checkboxes may be posted has data[name][0] and therefore
            // we need to remove it to get the absolute field name.
            $validationName = $options["type"] === "checkbox" ?
                preg_replace('/\[\d+\]$/', '', $name) :
                $name;

            if ($this->associatedEntity->hasErrors($validationName)) {
                if ((bool)$options['error']) {
                    $errorHtml = $this->generateInlineErrors($validationName);
                }
                $fieldHasErrors = true;
                $options['class'] .= " error ";
            }
        }
        unset($options["error"]);

        $label = "";
        if (!is_null($options['label'])) {
            $labelOptions = array(
                "for"    => $options["id"],
                "class" => $fieldHasErrors ? "error" : "",
                "label" => $options["label"],
            );

            $label .= $this->label($options['name'], $labelOptions);
        }
        unset($options['label']);

        switch (strtolower($options['type'])) {
            case "textarea":
                return $label . "\n" . $this->generateTextarea($options, $currentValue) . $errorHtml . "\n";
            case "select":
                return $label . "\n" . $this->generateSelect($options, $currentValue) . $errorHtml . "\n";
            case "radio":
                return $this->generateRadio($options, $currentValue) . $errorHtml . "\n" . $label . "\n";
            case "checkbox":
                return $this->generateCheckbox($options, $currentValue) . $errorHtml . "\n" . $label . "\n";
            case "hidden":
                return $label . "\n" . $this->generateHidden($options, $currentValue) . $errorHtml . "\n";
            default:
                return $label . "\n" . $this->generateTextinput($options, $currentValue) . $errorHtml . "\n";
        }
    }
583462
public function input($type, $name, $value = null, array $attributes = array(), array $extra = array())
    {
        return $this->build($type, $name, $value, $attributes, $extra);
    }
847025
public function input($type, $name, $value = null, array $attributes = [])
    {
        $tag = new Tag('input', $attributes);
        $tag->type = $type;
        $tag->name = $name;
        $tag->value = $value;
        return $tag;
    }
1016280
public function checkbox($name, $inputValue = 1, $checkByDefault = false)
    {
        $value = $this->value($name);
        // Define the state for the checkbox, when $value is null then we
        // use the $checkByDefault value directly, otherwise the checkbox will
        // be checked only if the $value is equal to the $inputValue.
        if (is_null($value)) {
            $checked = $checkByDefault;
        } else {
            $checked = $value == $inputValue;
        }

        $name = e($name);
        $inputValue = e($inputValue);
        $checked = $checked ? ' checked' : '';
        return "name=\"$name\" value=\"$inputValue\"$checked";
    }
630492
public function addCheckbox($name , $title ='' ,$value = '' , $extra = [] , $required = false , $msg = '' ,$group = '' , $readonly = false){
        $this->addChoose('checkbox' , $name , $title ,$value , $extra , $required , $msg , $group , $readonly );
        return $this;
    }
1124044
public static function input($type, $name, $attributes)
    {
        // Set id attribute to be same as the name
        // if one has not been set
        if (!isset($attributes['id'])) {
            $attributes['id'] =  $name;
        }

        // Check if the value is set in the
        // attributes array
        if (isset($attributes['value'])) {
            $value = $attributes['value'];
        }
        // Check if its in the _POST array
        elseif (isset($_POST[$name])) {
            $value = $_POST[$name];
        }
        // It's nowhere...
        else {
            $value = '';
        }

        // Add selected or checked attribute?
        foreach (array('selected', 'checked') as $attr) {
            if (isset($attributes[$attr]) and !$attributes[$attr]) {
                unset($attributes[$attr]);
            } elseif (isset($attributes[$attr])) {
                $attributes[$attr] = $attr;
            }
        }

        // Merge default attributes with
        // the specified attributes.
        $attributes = array_merge(array('type' => $type, 'name' => $name), $attributes);

        // Textareas
        if ($type == 'textarea') {
            return "<textarea " . HTML::buildAttributes($attributes) . ">{$value}</textarea>";
        }
        // Everything else
        else {
            // Don't pass the checked attribute if its false.
            if (isset($attributes['checked']) and !$attributes['checked']) {
                unset($attributes['checked']);
            }
            return "<input " . HTML::buildAttributes($attributes) . ">";
        }
    }
1261108
public function selectMultiple($name, $options = array(), $selected = null, array $attributes = array(), array $extra = array())
    {
        $attributes[] = 'multiple';
        return $this->doBuild('select', $name, $selected, $attributes, $extra, $options);
    }
250221
public static function checkbox($name, $checked = false, $options = [])
    {
        self::exclure($options);

        return self::checked('checkbox', $name, $checked, $options);
    }