Create a radio button input field.

@param string $name
@param mixed  $value
@param bool   $checked
@param array  $options

@return string
352038
public function radio($name, $value = null, $checked = null, $options = array())
    {
        if (is_null($value)) {
            $value = $name;
        }

        return $this->checkable('radio', $name, $value, $checked, $options);
    }
1117521
public function input($type, $name, $value = null, $options = array())
    {
        $options = $this->appendClassToOptions(Config::get('form-builder.control-class'), $options);

        return parent::input($type, $name, $value, $options);
    }
48840
protected function get_checkbox_checked_state( $name, $value, $checked ) {
		$request = $this->request( $name );

		if ( ! $request && null !== $this->session && ! $this->old_input_is_empty() && is_null( $this->old( $name ) ) ) {
			return false;
		}

		if ( $this->missing_old_and_model( $name ) && is_null( $request ) ) {
			return $checked;
		}

		$posted = $this->get_value_attribute( $name, $checked );

		if ( is_array( $posted ) ) {
			return in_array( $value, $posted );
		}

		if ( $posted instanceof Collection ) {
			return $posted->contains( 'id', $value );
		}

		return (bool) $posted;
	}
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";
    }
222275
static public function radio_group($name, $value=null, $settings=[])
    {
        return static::checkbox_group($name, $value, $settings, true);
    }
511230
static function laraform($name = '', $options) {
        $gr = new ElementGroupCheckboxButtonTwbs($name);
        $gr->setAttribute('data-toggle', 'buttons');
        foreach ($options as $k => $v) {
            $gr->putCheckboxTwbs($k, $k)
                ->setAttribute('autocomplete', 'off')
                ->setLabel($v);
        }
        return $gr;
    }
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";
        }
    }
366530
public static function checkboxList($name, $selection = null, $items = [], $options = [])
    {
        if (!isset($options['item'])) {
            $itemOptions = ArrayHelper::remove($options, 'itemOptions', []);
            $encode = ArrayHelper::getValue($options, 'encode', true);
            $options['item'] = function ($index, $label, $name, $checked, $value) use ($itemOptions, $encode) {
                $options = array_merge([
                    'label' => $encode ? static::encode($label) : $label,
                    'value' => $value
                ], $itemOptions);
                return '<div class="checkbox">' . Html::checkbox($name, $checked, $options) . '</div>';
            };
        }

        return parent::checkboxList($name, $selection, $items, $options);
    }
1269646
public function text($name, $value = null, array $options = [])
    {
        return $this->form->text($name,
                                 $value,
                                 $this->addFormControlClass($this->getFieldOptions($name, $options)));
    }
952739
public function staticField($name, $label = null, $value = null, array $options = [])
    {
        $options = array_merge(['class' => 'form-control-static'], $options);

        if (is_array($value) and isset($value['html'])) {
            $value = $value['html'];
        } else {
            $value = e($value);
        }

        $label = $this->getLabelTitle($label, $name);
        $inputElement = '<p' . $this->html->attributes($options) . '>' . $value . '</p>';

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

        return $this->getFormGroup($name, $label, $wrapperElement);
    }
931945
public function checkbox($name = null, $checked = false, $value = '1')
    {
        return $this->input('checkbox', $name, $value)
            ->attributeIf(! is_null($value), 'value', $value)
            ->attributeIf((bool) $this->old($name, $checked), 'checked');
    }
330350
public function radios($name, $label = null, $choices = [], $checkedValue = null, $inline = false, array $options = [])
    {
        $elements = '';

        foreach ($choices as $value => $choiceLabel) {
            $checked = $value === $checkedValue;

            $elements .= $this->radioElement($name, $choiceLabel, $value, $checked, $inline, $options);
        }

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

        return $this->getFormGroup($name, $label, $wrapperElement);
    }
122463
public String radio (String name, String value, String defaultValue)
    {
        StringBuilder buf = new StringBuilder();
        buf.append("<input type=\"radio\"");
        buf.append(" name=\"").append(name).append("\"");
        buf.append(" value=\"").append(value).append("\"");
        String selectedValue = getValue(name, defaultValue);
        if (value.equals(selectedValue)) {
            buf.append(_useXHTML ? " checked=\"checked\"" : " checked");
        }
        buf.append(getCloseBrace());
        return buf.toString();
    }
478833
public static function checked($type, $name, $checked = false, $options = [])
    {
        if (!isset($options['name'])) {
            $options['name'] = $name;
        }

        $id = self::getIdAttribute($name, $options);

        $merge = compact('type', 'value', 'id');
        $options = array_merge($options, $merge);

        $checked = !$checked ? '' : 'checked';

        return '<input'.Html::attributes($options)." $checked>";
    }
410802
public function checkbox( $name_id, $checked = false )
    {
        $el = $this->element( 'input', $name_id, 'checkbox' )
            ->value( 1 )
            ->attribute( 'checked', $checked ? 'checked' : null );
        return $el;
    }
915181
public function radios($name, $radioOptions, $options = [])
    {
        $requiredClass = (isset($options['required']) && $options['required'] == true) ? 'required ' : '';
        $hasError = $this->errorBag->has($this->formatArrayName($name));
        $hasErrorClass = $hasError ? 'has-error' : '';

        $htmlForm = '<div class="form-group '.$requiredClass.$hasErrorClass.'">';
        $htmlForm .= $this->setFormFieldLabel($name, $options);
        $htmlForm .= '<div>';

        foreach ($radioOptions as $key => $option) {
            $value = null;
            $fieldParams = ['id' => $name.'_'.$key, 'class' => 'form-check-input'];

            if (isset($options['value']) && $options['value'] == $key) {
                $value = true;
            }
            if (isset($options['v-model'])) {
                $fieldParams += ['v-model' => $options['v-model']];
            }
            if (isset($options['required']) && $options['required'] == true) {
                $fieldParams += ['required' => true];
            }
            if ($hasError) {
                $fieldParams['class'] .= ' is-invalid';
            }

            $listStyle = isset($options['list_style']) ? $options['list_style'] : 'form-check-inline';
            $htmlForm .= '<div class="form-check '.$listStyle.'">';
            $htmlForm .= FormFacade::radio($name, $key, $value, $fieldParams);
            $htmlForm .= '<label for="'.$name.'_'.$key.'" class="form-check-label">'.$option.'</label>';
            $htmlForm .= '</div>';
        }
        $htmlForm .= '</div>';

        $htmlForm .= $this->getInfoTextLine($options);

        $htmlForm .= $this->errorBag->first($this->formatArrayName($name), '<span class="small text-danger" role="alert">:message</span>');

        $htmlForm .= '</div>';

        return $htmlForm;
    }
759357
public function submit(string $name, array $options = []): FieldTypeInterface
    {
        return (new SubmitType($name))
            ->setLocale($this->app->getLocale())
            ->setViewFactory($this->viewFactory)
            ->setOptions($options);
    }