generate a checkbox

@param   array   array of attributes
@return  string
492036
public function generateCheckboxField($attr)
    {
        if (empty($attr['name'])) {
            return '';
        }

        $out = '';

        if ((isset($attr['hiddenCheckbox']) && $attr['hiddenCheckbox']) || ! isset($attr['hiddenCheckbox'])) {
            $out .= $this->input(
                $attr['name'],
                false,
                array(
                    'type' => 'hidden',
                    'wrapper' => false,
                    'id' => '_' . $attr['id'],
                    'value' => 0
                )
            );
        }
        unset($attr['hiddenCheckbox']);

        if (! isset($attr['value'])) {
            $attr['value'] = 1;
        }

        $out .= $this->Html->tag('input', $attr);
        return $out;
    }
1134908
public function getHtml(array $attributes = []): string
    {
        return self::buildTag('option', $this->getLabel(),
            array_merge(
                [
                    'value'    => $this->getValue(),
                    'selected' => $this->isSelected,
                ],
                $attributes)
        );
    }
610510
public function setCheckboxAttributes(array $a)
    {
        foreach ($this->checkboxes as $checkbox) {
            $checkbox->setAttributes($a);
            if (isset($a['tabindex'])) {
                $a['tabindex']++;
            }
        }
        return $this;
    }
390082
protected function renderCheckboxes($checkboxes)
    {
        $markup = '';
        foreach ($checkboxes as $boxes) {
            $markup .= '<li class="disable-element">';
            if (is_array($boxes)) {
                if (isset($boxes['__all__'])) {
                    $markup .= $this->renderCheckbox($boxes['__all__'], 'disable-elements-toggle');
                    unset($boxes['__all__']);
                }

                $markup .= '<ul class="disable-elements">' . $this->renderCheckboxes($boxes) . '</ul>';
            } else {
                $markup .= $this->renderCheckbox($boxes);
            }
            $markup .= '</li>';
        }
        return $markup;
    }
1009297
private function buildCheckbox($ele){

        $formNs = $this->formNs;

        $html = '<div class="'.$formNs.'form-group">';
        if ($ele['title']){
            $html .= '<label class="'.$formNs.'form-label" for="'.$ele['id'].'">'.$ele['title'].'</label>';
        }
        $html .= '<div class="'.$formNs.'form-content">';

        if (is_string($ele['value'])){
            $ele['value'] = $ele['value'] ? explode(',' , $ele['value']) : [];
        }

        foreach ($ele['extra'] as $k=>$v){
            if (in_array($k , $ele['value'])){
                $html .= '<label class="'.$formNs.'form-checkbox"><input type="checkbox" name="'.$ele['name'].'" value="'.$k.'" checked="" >'.$v.'</label>';
            }else {
                $html .= '<label class="'.$formNs.'form-checkbox"><input type="checkbox" name="'.$ele['name'].'" value="'.$k.'" >'.$v.'</label>';
            }
        }

        if ($ele['msg']){
            $html .= '<p class="'.$formNs.'form-help">'.$ele['msg'].'</p>';
        }
        $html .= '</div>';
        $html .= '</div>';

        return $html;
    }
512558
protected function generateCheckboxByGroup($id, $label, $name, $checked, array $options)
    {
        $identifier = \sprintf('%s_%s', $name, $id);
        $key = \sprintf('%s[]', $name);
        $active = \in_array($id, (array) $checked);

        $options['id'] = $identifier;

        $control = $this->checkbox($key, $id, $active, $options);

        $label = $this->label($identifier, $label);

        return \implode(' ', [$control, $label]);
    }
528308
function _createElements() {
        $attributes = $this->getAttributes();
        if (is_null($attributes)) {
            $attributes = array();
        }
        if (!isset($attributes['size'])) {
            $attributes['size'] = 3;
        }
        $this->_elements = array();
        // E_STRICT creating elements without forms is nasty because it internally uses $this
        $number = $this->createFormElement('text', 'number', get_string('time', 'form'), $attributes, true);
        $number->set_force_ltr(true);
        $this->_elements[] = $number;
        unset($attributes['size']);
        $this->_elements[] = $this->createFormElement('select', 'timeunit', get_string('timeunit', 'form'), $this->get_units(), $attributes, true);
        // If optional we add a checkbox which the user can use to turn if on
        if($this->_options['optional']) {
            $this->_elements[] = $this->createFormElement('checkbox', 'enabled', null, get_string('enable'), $this->getAttributes(), true);
        }
        foreach ($this->_elements as $element){
            if (method_exists($element, 'setHiddenLabel')){
                $element->setHiddenLabel(true);
            }
        }
    }
85196
public function getHtml(array $attributes = []): string
    {
        return self::buildTag('input', null,
            array_merge(
                [
                    'type'    => 'radio',
                    'name'    => $this->name !== '' ? $this->name : false,
                    'value'   => $this->value,
                    'checked' => $this->isSelected,
                ],
                $attributes
            )
        );
    }
166650
public function attributesToString(array $attributes = []): string
    {
        $html = [];
        foreach ($attributes as $key => $value) {
            if (is_array($value)) {
                $value = json_encode($value);
            }

            if (in_array($key, $this->booleanAttributes, true)) {
                $value = $this->prepareBooleanAttribute($key, $value);
            }

            if ($value === '') {
                continue;
            }

            $html[] = sprintf(
                '%s="%s"',
                $this->escapeAttribute($key),
                $this->escapeAttribute($value)
            );
        }

        return implode(' ', $html);
    }
460321
public function checkbox($name = null, $value = null, $status = false, $attr = null)
    {
        $input = $this->createInput('checkbox', $name, $value, $attr);

        if($status)
            $input->attr('checked', true);

        return $input;
    }
115048
protected function generateAttributes(array $attributes)
	{
		if (isset($attributes['style']) && is_array($attributes['style']))
		{
			$attributes['style'] = $this->generateStyle($attributes['style']);
		}

		ksort($attributes);
		$xsl = '';
		foreach ($attributes as $attrName => $attrValue)
		{
			$innerXML = (strpos($attrValue, '<xsl:') !== false) ? $attrValue : AVTHelper::toXSL($attrValue);

			$xsl .= '<xsl:attribute name="' . htmlspecialchars($attrName, ENT_QUOTES, 'UTF-8') . '">' . $innerXML . '</xsl:attribute>';
		}

		return $xsl;
	}
930563
public function attributes(Array $attributes) : String
    {
        unset($this->settings['attr']['perm']);

        $attribute = '';

        if( ! empty($this->settings['attr']) )
        {
            $attributes = array_merge($attributes, $this->settings['attr']);

            $this->settings['attr'] = [];
        }

        foreach( $attributes as $key => $values )
        {
            if( is_numeric($key) )
            {
                $attribute .= ' '.$values;
            }
            else
            {
                if( ! empty($key) )
                {
                    $attribute .= ' '.$key.'="'.$values.'"';
                }
            }
        }

        return $attribute;
    }
5356
public function render($attr = null)
  {
    if ($this->getOptions()) {
      $tag = new CheckboxListing(
        $this->getInputName(),
        $this->getOptions(),
        $this->getValue()
      );

      if ($this->getIgnoreOptionsKeys()) {
        $tag->setIgnoreOptionsKeys(true);
      }
    } else {
      $tag = new \SQRT\Tag\Checkbox(
        $this->getInputName(),
        $this->getInputValue(),
        null,
        $this->getValue() == $this->getInputValue()
      );
    }

    return $tag;
  }
202405
public static function checkbox($field, $value = null, $checked = null, array $attributes = array())
	{
		return static::$instance->checkbox($field, $value, $checked, $attributes);
	}
308958
public function prepare(&$attrs)
    {
        $value = $this->getValue();

        $attrs['type'] = 'checkbox';
        $attrs['name'] = $this->getFieldName();
        $attrs['id'] = $this->getAttribute('id', $this->getId());
        $attrs['class'] = $this->getAttribute('class');
        $attrs['readonly'] = $this->getAttribute('readonly');
        $attrs['disabled'] = $this->getAttribute('disabled');
        $attrs['onchange'] = $this->getAttribute('onchange');
        $attrs['value'] = $this->getAttribute('value');
        $attrs['checked'] = $value ? 'true' : null;
        $attrs['required'] = $this->required;
    }
1163408
public function getHtml(array $attributes = []): string
    {
        $optionsHtml = '';
        foreach ($this->options as $option) {
            $optionsHtml .= $option->getHtml();
        }

        return self::buildTag('select', $optionsHtml,
            array_merge(
                [
                    'name'     => $this->getName(),
                    'required' => $this->isRequired() && $this->hasEmptyOption,
                ],
                $attributes
            ), true
        );
    }
559192
public function checkbox($name, $value = 1, $selected = null, array $attributes = array(), array $extra = array())
    {
        return $this->build('checkbox', $name, $selected, $attributes, $extra, $value);
    }