@uses BaseHtmlTrait::BaseHtmlTrait

@param string $name
@param mixed $value
@param null|mixed $checkedValue
@param array $htmlOptions
@return string
499822
public static function radio(
        $name,
        $value,
        $checkedValue = null,
        array $htmlOptions = []
    ) {
    	$radio = self::input('radio', $name, $value);
    	if ($checkedValue == $value) {
    		$radio .= ' checked="checked"';
    	}
    	$radio .= self::htmlOptions($htmlOptions) .'>';
    	return $radio;
    }
755515
public function checkWithValue($name, $value)
    {
        /** @var \Behat\Mink\Element\NodeElement $nodeElement */
        $nodeElement = $this->getSession()->getPage()->find(
            'xpath',
            sprintf(
                '//input[@type="checkbox" and @name="%s" and @value="%s"]',
                $name,
                $value
            )
        );

        if (null === $nodeElement) {
            // Yikes! It aint where we want it
            throw new ExpectationException(
                sprintf(
                    'A checkbox with the value "%s" is not in the page.',
                    $value
                ),
                $this->getSession()->getDriver()
            );
        }

        // Make the magic happen
        $nodeElement->check();
    }
904206
static function laraform($html, $name = null) {
        $el = new ElementStaticTwbs($name ? $name : uniqid());
        $el->setValue($html);

        return $el;
    }
615829
public function wpEditor($name, $value = null, $options = array())
    {
        ob_start();

        $value = $this->getValueAttribute($name, $value);

        $value = $this->html->decode($value);

        wp_editor($value, $name, $options = array());

        $wpEditor = ob_get_contents();

        ob_end_clean();

        return $wpEditor;
    }
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;
    }
279480
public function getCheckbox($name, array $options=[]) {
		$choices = $this->getChoices();
		$default = $this->value;

		$value = isset($options['value']) ? $options['value']:null;
		if($value===null) {
			foreach($choices as $k=>$v) {
				if($v == $name) {
					$value = $k;
					break;
				}
			}
		}
		if($value === null)
			throw new \Exception('No value for checkbox '.$name);

		if(in_array($value, $default))
			$options['attrs']['checked'] = 'checked';
		$options['label'] = $name;

		return $this->getTopForm()->getWidget('checkbox', $this->name.'[]', $value, $options);
	}
173121
public function label($name, $value = null, $options = [], $escape_html = true)
    {
        $this->labels[] = $name;

        $options = $this->html->attributes($options);

        $value = $this->formatLabel($name, $value);

        if ($escape_html) {
            $value = $this->html->entities($value);
        }

        return $this->toHtmlString('<label for="' . $name . '"' . $options . '>' . $value . '</label>');
    }
936414
public static function checkboxSmart($name, $checked = false, $options = [])
    {
        $options['checked'] = (boolean)$checked;
        $value = array_key_exists('value', $options) ? $options['value'] : '1';
        if (isset($options['uncheck'])) {
            // add a hidden field so that if the checkbox is not selected, it still submits a value
            $hidden = static::hiddenInput($name, $options['uncheck']);
            unset($options['uncheck']);
        } else {
            $hidden = '';
        }
        if (isset($options['label'])) {
            $label = $options['label'];
            $labelOptions = isset($options['labelOptions']) ? $options['labelOptions'] : [];
            unset($options['label'], $options['labelOptions']);
            $iconOptions = ArrayHelper::remove($options, 'iconOptions', []);
            $iconTag = ArrayHelper::remove($iconOptions, 'tag', 'i');
            $content = static::label(static::input('checkbox', $name, $value, $options) . Html::tag($iconTag, null, $iconOptions) . $label, null, $labelOptions);
            return $hidden . $content;
        } else {
            return $hidden . static::input('checkbox', $name, $value, $options);
        }
    }
1091156
public static function textAreaControlGroup($name, $value = '', $htmlOptions = array())
    {
        return self::controlGroup(self::INPUT_TYPE_TEXTAREA, $name, $value, $htmlOptions);
    }
1180281
public function toHtmlInternal($value = null, $submitted = false, $intCount = 0)
    {
        if ($this->__type == ValidForm::VFORM_CHECK_LIST) {
            $strName = ($intCount == 0) ? $this->__name : str_replace("[]", "", $this->__name) . "_" . $intCount . "[]";
        } else {
            $strName = ($intCount == 0) ? $this->__name : $this->__name . "_" . $intCount;
        }
        $strId = ($intCount == 0) ? $this->__id : $this->__id . "_" . $intCount;

        if (is_array($value)) {
            foreach ($value as $valueItem) {
                if ($valueItem == $this->__value) {
                    $this->setFieldMeta("checked", "checked");
                    break;
                } else {
                    if ($this->__type == ValidForm::VFORM_RADIO_LIST) {
                        // Uncheck all others if this is a radio list
                        $this->setFieldMeta("checked", null, true); // Remove 'checked'
                    }
                }
            }
        } else {
            $blnCheckedSet = false;
            if ($this->__checked && is_null($value) && ! $submitted) {
                $this->setFieldMeta("checked", "checked");
                $blnCheckedSet = true;
            } else {
                $this->setFieldMeta("checked", null, true); // Remove 'checked'
            }

            if ($value == $this->__value || $blnCheckedSet) {
                $this->setFieldMeta("checked", "checked");
            } else {
                $this->setFieldMeta("checked", null, true); // Remove 'checked'
            }
        }

        // *** Convert the Element type to HTML type.
        /* TODO: Refactor to typeToHtmlType method and implement in all element classes. */
        $type = "";
        switch ($this->__type) {
            case ValidForm::VFORM_RADIO_LIST:
                $type = "radio";
                break;
            case ValidForm::VFORM_CHECK_LIST:
                $type = "checkbox";
                break;
        }

        $strOutput = "<label for=\"{$strId}\"{$this->__getLabelMetaString()}>\n";
        $strOutput .= "<input type=\"{$type}\" value=\"{$this->__value}\" name=\"{$strName}\"
                        id=\"{$strId}\"{$this->__getFieldMetaString()}/>{$this->__label}\n";
        $strOutput .= "</label>\n";

        return $strOutput;
    }
1373373
public static function radio($name, $checked = false, $options = [])
    {
        self::exclure($options, ['value']);

        return self::checked('radio', $name, $checked, $options);
    }
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']);
    }
71208
function (name, checked) {

		var radioHtml = '<input type="radio" class="leaflet-control-layers-selector" name="' +
				name + '"' + (checked ? ' checked="checked"' : '') + '/>';

		var radioFragment = document.createElement('div');
		radioFragment.innerHTML = radioHtml;

		return radioFragment.firstChild;
	}
218659
protected function _checkedOptions($value, $selected, array $attrs)
    {
        $attrs['checked'] = false;
        if (is_array($selected)) {
            foreach ($selected as $val) {
                if ($value == $val) {
                    $attrs['checked'] = 'checked';
                    break;
                }
            }
        } else {
            if ($value == $selected) {
                $attrs['checked'] = 'checked';
            }
        }

        return $attrs;
    }
1067668
public function input($type, $name, $value = null, $options = array())
    {
        if ( ! isset($options['name'])) $options['name'] = $name;

        // We will get the appropriate value for the given field. We will look for the
        // value in the session for the value in the old input data then we'll look
        // in the model instance if one is set. Otherwise we will just use empty.
        $id = $this->getIdAttribute($name, $options);

        if ( ! in_array($type, $this->skipValueTypes))
        {
            $value = $this->getValueAttribute($name, $value);
        }

        // Once we have the type, value, and ID we can merge them into the rest of the
        // attributes array so we can convert them into their HTML attribute format
        // when creating the HTML element. Then, we will return the entire input.
        $merge = compact('type', 'value', 'id');

        $options = array_merge($options, $merge);

        return '<input'.$this->html->attributes($options).'>';
    }
106956
public function setOption($name, $value) {
    if (!array_key_exists($name, $this->options)) {
      throw new InvalidArgumentException(sprintf('Undefined option: "%s"', $name));
    }

    $this->options[$name] = $value;
    $this->getHttpClient()->setOption($name, $value);
  }
305630
public static function textarea($name, $value = null, array $options = [])
    {
        self::exclure($options);

        //for textarea size
        $options = self::setTextAreaSize($options);

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

        unset($options['size']);

        $options = Html::attributes($options);

        return '<textarea'.$options.'>'.e($value).'</textarea>';
    }