Gets creates an checkbox/radio button html field for a given field.

@param CrestApps\CodeGeneraotor\Support\Field $field
@param CrestApps\CodeGeneraotor\Support\ValidationParser $parser

@return string
760063
protected function getPickItemsHtml(Field $field, ValidationParser $parser)
    {
        $fields = '';

        if ($field->isBoolean()) {
            // At this point we know this is a boolean field, we only need one option
            $fields .= $this->getPickItemsHtmlField($field, $field->getTrueBooleanOption(), $parser) . PHP_EOL;
        } else {
            if (is_null($field->getOptionsByLang())) {
                throw new Exception('The field "' . $field->name . '" has no options!');
            }

            foreach ($field->getOptionsByLang() as $index => $option) {
                $fields .= $this->getPickItemsHtmlField($field, $option, $parser) . PHP_EOL;
            }
        }

        $this->wrapField($fields, $field, true, (($field->htmlType == 'checkbox') && !$field->isBoolean()) ? 'required' : '');

        return $fields;
    }
526536
protected function getInput()
	{
		$html = array();

		// Initialize some field attributes.
		$class = $this->element['class'] ? ' class="radio ' . (string) $this->element['class'] . '"' : ' class="radio"';

		// Start the radio field output.
		$html[] = '<fieldset id="' . $this->id . '"' . $class . '>';

		// Get the field options.
		$options = $this->getOptions();

		// Build the radio field output.
		foreach ($options as $i => $option)
		{
			// Initialize some option attributes.
			$checked = ((string) $option->value == (string) $this->value) ? ' checked="checked"' : '';
			$class = !empty($option->class) ? ' class="' . $option->class . '"' : '';
			$disabled = !empty($option->disable) ? ' disabled="disabled"' : '';

			// Initialize some JavaScript option attributes.
			$onclick = !empty($option->onclick) ? ' onclick="' . $option->onclick . '"' : '';

			$html[] = '<input type="radio" id="' . $this->id . $i . '" name="' . $this->name . '"' . ' value="'
				. htmlspecialchars($option->value, ENT_COMPAT, 'UTF-8') . '"' . $checked . $class . $onclick . $disabled . '/>';

			$html[] = '<label for="' . $this->id . $i . '"' . $class . '>'
				. Text::alt($option->text, preg_replace('/[^a-zA-Z0-9_\-]/', '_', $this->fieldname)) . '</label>';
		}

		// End the radio field output.
		$html[] = '</fieldset>';

		return implode($html);
	}
995335
public function checkboxes(FieldContract $field): Htmlable
    {
        return $this->form->checkboxes(
            $field->get('name'),
            $this->asArray($field->get('options')),
            $field->get('checked'),
            $field->get('attributes')
        );
    }
783021
public function getFileHtmlField(Field $field)
    {
        $stub = $this->getStubContent('form-file-field.blade', $this->template);

        $this->replaceFieldName($stub, $field->name)
            ->replaceCssClass($stub, $field->cssClass)
            ->replaceRowFieldValue($stub, $this->getFieldAccessorValue($field, 'show'))
            ->wrapField($stub, $field)
            ->replaceCommonTemplates($stub, $field);

        return $stub;
    }
1002442
public function getOptionParser() {
		$parser = parent::getOptionParser();
		$parser->addArgument('name(s)', array(
			'required' => true,
			'help' => 'Enter one or more cache/view names separated by comma or "all"' .
			"\n<comment>(choises: " . implode(',', array_merge(Cache::configured(), array('all'))) . ")</comment>"
		));
		$parser->addOption('views', array(
			'boolean' => true,
			'help' => 'If set views files will be deleted' .
			"\n<comment>(choises: " . implode(',', array('view_file_name*', 'all')) . ")</comment>"
		));
		return $parser->description('Clear cache');
	}
751363
protected function getLabelFromField(Field $field = null)
    {
        if (empty($field)) {
            return $this->getStubContent('form-nolabel-field.blade', $this->template);
        }

        return $this->getLabelElement($field->name, $field->getLabel());
    }
757543
public function getApixFieldHtml( $config, $field, $value = null ) {

		switch( $field->type ) {

			case FormField::TYPE_TEXT: {

				return $this->getApixTextHtml( $config, $field, $value );
			}
			case FormField::TYPE_HIDDEN: {

				return $this->getApixHiddenHtml( $config, $field, $value );
			}
			case FormField::TYPE_PASSWORD: {

				return $this->getApixPasswordHtml( $config, $field );
			}
			case FormField::TYPE_TEXTAREA: {

				return $this->getApixTextareaHtml( $config, $field, $value );
			}
			case FormField::TYPE_CHECKBOX: {

				return $this->getApixCheckboxHtml( $config, $field, $value );
			}
			case FormField::TYPE_TOGGLE: {

				return $this->getApixToggleHtml( $config, $field, $value );
			}
			case FormField::TYPE_CHECKBOX_GROUP: {

				return $this->getApixCheckboxGroupHtml( $config, $field, $value );
			}
			case FormField::TYPE_RADIO: {

				return $this->getApixRadioHtml( $config, $field, $value );
			}
			case FormField::TYPE_RADIO_GROUP: {

				return $this->getApixRadioGroupHtml( $config, $field, $value );
			}
			case FormField::TYPE_SELECT: {

				return $this->getApixSelectHtml( $config, $field, $value );
			}
			case FormField::TYPE_RATING: {

				return $this->getApixRatingHtml( $config, $field, $value );
			}
			case FormField::TYPE_DATE: {

				return $this->getApixDateHtml( $config, $field, $value );
			}
		}
	}
321890
public function getMessage($validator, string $field, array $args = [], $message = null): string
    {
        $rawName = \is_string($validator) ? $validator : 'callback';
        $params  = [
            '{attr}' => $this->getTranslate($field)
        ];

        // get message from built in dict.
        if (!$message) {
            $message = $this->findMessage($field, $rawName) ?: GlobalMessage::getDefault();
            // is array. It's defined multi error messages
        } elseif (\is_array($message)) {
            $message = $message[$rawName] ?? $this->findMessage($field, $rawName);

            if (!$message) { // use default
                return \strtr(GlobalMessage::getDefault(), $params);
            }
        } else {
            $message = (string)$message;
        }

        /** @see GlobalMessage::$messages['size'] */
        if (\is_array($message)) {
            $msgKey  = \count($args);
            $message = $message[$msgKey] ?? $message[0];
        }

        if (false === \strpos($message, '{')) {
            return $message;
        }

        foreach ($args as $key => $value) {
            $key = \is_int($key) ? "value{$key}" : $key;
            // build params
            $params['{' . $key . '}'] = \is_array($value) ? \implode(',', $value) : $value;
        }

        return \strtr($message, $params);
    }
935850
public function resolveForSelection($field)
    {
        if (! is_null($element = $this->findById($field))) {
            return $element;
        }

        return $this->firstOrFail([
            $field, "select[name='{$field}']",
        ]);
    }
202405
public static function checkbox($field, $value = null, $checked = null, array $attributes = array())
	{
		return static::$instance->checkbox($field, $value, $checked, $attributes);
	}
589401
private function processInput($field)
    {
        $output = '';
        if ($field['div'] == TRUE) $output .= $this->div('open', $field['divId'], $field['divClass'], $field['divAttributes']);
        switch (strtolower($field['type'])) {
            case 'a':
                if ($field['name'] != '' || $field['value'] != '') {
                    $url = sprintf('%s?%s', $field['name'], $field['value']);
                }
                $output .= $this->a('full', $field['id'], $field['class'], $field['attributes'], $url, $field['labelText']);
                break;
            case 'br':
                $output .= $this->br('full', $field['id'], $field['class'], $field['attributes']);
                break;
            case 'divopen':
                $output .= $this->div('open', $field['id'], $field['class'], $field['attributes']);
                break;
            case 'divclose':
                $output .= $this->div('close');
                break;
            case 'span':
                $output .= $this->span('full', $field['id'], $field['class'], $field['attributes'], $field['value']);
                break;
            case 'checkbox':
            case 'radio':
                $output .= $this->input('full', $field['id'], $field['class'], $field['attributes'], $field['type'], $field['name'], $field['value']);
                $output .= $this->label('full', $field['labelId'], $field['labelClass'], $field['labelAttributes'], $field['id'], $field['labelText']);
                break;
            case 'select':
                if ($field['labelText'] != '') {
                    $output .= $this->label('full', $field['labelId'], $field['labelClass'], $field['labelAttributes'], $field['id'], $field['labelText']);
                }
                $output .= $this->select('full', $field['id'], $field['class'], $field['attributes'], $field['name'], $field['value']);
                break;
            case 'textarea':
                if ($field['labelText'] != '') {
                    $output .= $this->label('full', $field['labelId'], $field['labelClass'], $field['labelAttributes'], $field['id'], $field['labelText']);
                    $output .= $this->br('full');
                }
                $output .= $this->textarea('full', $field['id'], $field['class'], $field['attributes'], $field['name'], 0, 0, $field['value']);
                break;
            default:
                if ($field['labelText'] != '') {
                    $output .= $this->label('full', $field['labelId'], $field['labelClass'], $field['labelAttributes'], $field['id'], $field['labelText']);
                }
                if ($field['placeholder'] != '') $this->fixInputAttributes($field);
                $output .= $this->input('full', $field['id'], $field['class'], $field['attributes'], $field['type'], $field['name'], $field['value']);
        }
        if ($field['div'] == TRUE) $output .= $this->div('close');
        return $output;
    }
803966
public function getHtml(): string
  {
    $this->attributes['type'] = 'radio';
    $this->attributes['name'] = $this->submitName;

    // A radio button is checked if and only if its value equals to the value of attribute value.
    if (isset($this->attributes['value']) &&
      (Cast::toManString($this->value, '')===Cast::toManString($this->attributes['value'], '')))
    {
      $this->attributes['checked'] = true;
    }
    else
    {
      unset($this->attributes['checked']);
    }

    $ret = $this->prefix;
    $ret .= $this->getHtmlPrefixLabel();
    $ret .= Html::generateVoidElement('input', $this->attributes);
    $ret .= $this->getHtmlPostfixLabel();
    $ret .= $this->postfix;

    return $ret;
  }
1316778
protected function _getInput($fieldName, $options)
    {
        $label = $options['labelOptions'];
        unset($options['labelOptions']);
        switch (strtolower($options['type'])) {
            case 'select':
                $opts = $options['options'];
                unset($options['options']);

                return $this->select($fieldName, $opts, $options + ['label' => $label]);
            case 'radio':
                $opts = $options['options'];
                unset($options['options']);

                return $this->radio($fieldName, $opts, $options + ['label' => $label]);
            case 'multicheckbox':
                $opts = $options['options'];
                unset($options['options']);

                return $this->multiCheckbox($fieldName, $opts, $options + ['label' => $label]);
            case 'input':
                throw new RuntimeException("Invalid type 'input' used for field '$fieldName'");

            default:
                return $this->{$options['type']}($fieldName, $options);
        }
    }
52350
public function select(FieldContract $field)
    {
        $attributes  = $this->html->decorate($field->get('attributes'));
        $optionsData = $field->get('optionsData') ?: [];
        if (array_get($attributes, 'data-selectar') === false or ! is_null(array_get($attributes, 'data-selectar--search'))) {
            unset($attributes['data-selectar']);
        }
        return $this->form->select(
                        $field->get('name'), $field->get('options'), $field->get('value'), $attributes, $optionsData
        );
    }
166256
private function getSelector($field)
    {
        if (\is_string($field)) {
            if (isset($this->trigs[$field]['selector'])) {
                return $this->trigs[$field]['selector'];
            }
            $fields = $this->getFieldsWithName($field);
            $field = $fields[0];
        }
        if (\in_array($field->attribs['type'], array('checkbox','radio','submit'))) {
            $formId = $this->form->cfg['attribs']['id'];
            $selector = '#'.$formId.' input[name=\"'.$field->attribs['name'].'\"]';
        } else {
            $fieldId = $field->id;
            $selector = '#'.$fieldId;
        }
        return $selector;
    }
902240
protected function checkBox(CheckBox $checkbox)
    {
        $tag = new Tag('input');
        $tag->setAttribute('type', 'checkbox');

        if (!$checkbox->getId() && $checkbox->getLabel()) {
            $checkbox->setId('field-' . uniqid('checkbox'));
        }

        if ($checkbox->isChecked()) {
            $tag->setAttribute('checked', 'checked');
        }

        $html = $this->parseTag($tag, $checkbox);

        if ($checkbox->getLabel()) {
            $label = new Tag('label', $checkbox->getLabel());
            $label->setAttribute('for', $checkbox->getId());
            $html .= $label->render();
        }

        return $html;
    }
3883
protected function getComparisonValue($validator, $comparisonField)
    {
        $comparisonFieldValue = isset($validator->getData()[$comparisonField]) ? $validator->getData()[$comparisonField] : null;
        return $comparisonFieldValue;
    }