Returns the main input field for rendering

@since  1.0.0
@see    \uix\ui\uix
@access public
@return string Input field HTML string
490476
public function input() {

		$output       = '<input type="hidden" value="' . esc_attr( $this->get_value() ) . '" ' . $this->build_attributes() . '>';
		$button_text  = isset( $this->struct['add_label'] ) ? $this->struct['add_label'] : __( 'Select Image', 'uix' );
		$preview_size = isset( $this->struct['preview_size'] ) ? $this->struct['preview_size'] : 'medium';
		$type         = isset( $this->struct['type'] ) ? $this->struct['type'] : 'id';
		$size         = isset( $this->struct['size'] ) ? $this->struct['size'] : 'full';
		$output      .= $this->preview( $preview_size );
		$output      .= '<button type="button" data-size="' . esc_attr( $size ) . '" data-type="' . esc_attr( $type ) . '" data-preview-size="' . esc_attr( $preview_size ) . '" data-target="' . esc_attr( $this->id() ) . '" class="button button-small uix-image-control-button">' . esc_html( $button_text ) . '</button>';

		return $output;
	}
268273
public function render() {
		
		$model = $this->getParent()->getModel();
		$attribute = $this->name;
		$options = $this->generateGroupOptions();

		if (isset(self::$inputTypes[$this->type])) {
			$method = self::$inputTypes[$this->type];
			// FIXME ... why we are passing $this->attributes ... most all TbActiveForm method only require $options 
			return $this->getParent()->getActiveFormWidget()->$method($model, $attribute, $this->attributes, $options);
			/* no need for this as now data goes inside $options['widgetOptions']['data']
			switch ($method) {
				case 'listBoxGroup':
				case 'dropDownListGroup':
				case 'checkBoxListGroup':
				case 'radioButtonListGroup': 
					return $this->getParent()->getActiveFormWidget()->$method($model, $attribute, $this->attributes, $this->items, $options);

				default:
					return $this->getParent()->getActiveFormWidget()->$method($model, $attribute, $this->attributes, $options);
			}
			*/
		} else {
			$attributes = $this->attributes;
			$attributes['model'] = $this->getParent()->getModel();
			$attributes['attribute'] = $this->name;

			return $this->getParent()->getActiveFormWidget()->customFieldGroup(
				array(array($this->getParent()->getOwner(), 'widget'), array($this->type, $attributes, true)),
				$model,
				$attribute,
				$options
			);
		}
	}
982132
public function field()
    {
        $input = new HTMLBrick('input', $this->label, [
            'type' => $this->type,
            'id'   => $this->id,
            'name' => $this->name,
        ]);
        if ($this->placeholder) {
            $input->attr['placeholder'] = $this->placeholder;
        }
        if ($this->value) {
            $input->attr['value'] = $this->value;
        }
        $input->addClass('form-control');

        return $input;
    }
576409
public function getInput() {
        $options = $this->htmlOptions;
        $options['class'] = (isset($options['class']) ? $options['class'] . ' ' : '') . $this->inputClass;
        return Form::get()->select($this->getName(), $this->options, $this->getValue(), $options, $this->emptyValue);
    }
378631
protected function getInput() {

        $js = [];

        $defaultAltFormat = 'd/m/Y';
        $defaultFormat    = 'Y-m-d';

        if ($this->element['enableTime'] == "true") {
            $defaultAltFormat .= ' H:i';
            $defaultFormat    .= ' H:i';
        }

        if ($this->element['enableSeconds'] == "true") {
            $defaultAltFormat .= ':S';
            $defaultAltFormat .= ':S';
        }

        $class         = $this->element['class'] ? ' class="' . (string) $this->element['class'] . '"' : '';
        $placeholder   = $this->element['placeholder'] ? ' placeholder="' . htmlspecialchars((string) $this->element['placeholder']) . '"' : null;
        $altFormat     = $this->element['displayFormat'] ? (string) $this->element['displayFormat'] : $defaultAltFormat;
        $defaultFormat = $this->element['dateFormat'] ? (string) $this->element['dateFormat'] : $defaultFormat;
        $minDate       = $this->element['minDate'] ? (string) $this->element['minDate'] : null;
        $maxDate       = $this->element['maxDate'] ? (string) $this->element['maxDate'] : null;

        $options = [
            "altInput"   => true,
            "altFormat"  => $this->getText()->translate($altFormat),
            "utc"        => false,
            "time_24hr"  => true,
            "dateFormat" => $defaultFormat
        ];

        if ($this->element['class']) {
            $options["altInputClass"] = (string) $this->element['class'];
        }

        if ($this->element['allowInput']) {
            $options['allowInput'] = ($this->element['allowInput'] == "true");
        }

        if ($this->element['dateFormat']) {
            $options['dateFormat'] = (string) $this->element['dateFormat'];
        }

        if ($this->element['enableTime']) {
            $options['enableTime'] = ($this->element['enableTime'] == "true");
        }

        if ($this->element['hourIncrement']) {
            $options['hourIncrement'] = (int) $this->element['hourIncrement'];
        }

        if ($this->element['minuteIncrement']) {
            $options['minuteIncrement'] = (int) $this->element['minuteIncrement'];
        }

        if ($this->element['nextArrow']) {
            $options['nextArrow'] = (string) $this->element['nextArrow'];
        }

        if ($this->element['noCalendar']) {
            $options['noCalendar'] = ($this->element['noCalendar'] == "true");
        }

        if ($this->element['prevArrow']) {
            $options['prevArrow'] = (string) $this->element['prevArrow'];
        }

        if ($this->element['shorthandCurrentMonth']) {
            $options['shorthandCurrentMonth'] = ($this->element['shorthandCurrentMonth'] == "true");
        }

        if ($this->element['static']) {
            $options['static'] = ($this->element['static'] == "true");
        }

        if ($this->element['time_24hr']) {
            $options['time_24hr'] = ($this->element['time_24hr'] == "true");
        }

        if ($this->element['utc']) {
            $options['utc'] = ($this->element['utc'] == "true");
        }

        if (isset($minDate)) {
            if (strpos($minDate, 'field:') !== false) {

                $parts     = explode(".", substr($minDate, 6), 2);
                $fieldName = isset($parts[1]) ? $parts[1] : $parts[0];
                $groupName = isset($parts[1]) ? $parts[0] : null;
                $field     = $this->form->getField($fieldName, $groupName);

                if ($field !== false) {

                    $js[] = "var old_min_" . $field->id . "; 
document.getElementById('" . $field->id . "').addEventListener('change', function() {
    var v = document.getElementById('" . $field->id . "')._flatpickr.selectedDates[0];
    if (v && (!old_min_" . $field->id . " || old_min_" . $field->id . ".getTime() !== v.getTime())) {
        old_min_" . $field->id . " = v;
        document.getElementById('" . $this->id . "')._flatpickr.set('minDate', v);                 
    }
});\n";

                }

            } else {
                $options['minDate'] = $minDate;
            }
        }

        if (isset($maxDate)) {
            if (strpos($maxDate, 'field:') !== false) {

                $parts     = explode(".", substr($maxDate, 6), 2);
                $fieldName = isset($parts[1]) ? $parts[1] : $parts[0];
                $groupName = isset($parts[1]) ? $parts[0] : null;
                $field     = $this->form->getField($fieldName, $groupName);

                if ($field !== false) {

                    $js[] = "var old_max_" . $field->id . "; 
document.getElementById('" . $field->id . "').addEventListener('change', function() {
    var v = document.getElementById('" . $field->id . "')._flatpickr.selectedDates[0];
    if (v && (!old_max_" . $field->id . " || old_max_" . $field->id . ".getTime() !== v.getTime())) {
        old_max_" . $field->id . " = v;
        document.getElementById('" . $this->id . "')._flatpickr.set('maxDate', v);                 
    }
});\n";
                }

            } else {
                $options['maxDate'] = $maxDate;
            }
        }

        if ($this->element['wrap']) {
            $options['wrap'] = ($this->element['wrap'] == "true");
        }

        if ($this->element['clickOpens']) {
            $options['clickOpens'] = ($this->element['clickOpens'] == "true");
        }

        if ($this->element['inline']) {
            $options['inline'] = ($this->element['inline'] == "true");
        }

        if ($this->element['weekNumbers']) {
            $options['weekNumbers'] = ($this->element['weekNumbers'] == "true");
        }

        if ($this->element['weekNumbers']) {
            $options['weekNumbers'] = ($this->element['weekNumbers'] == "true");
        }

        if (!$options['utc'] && !$this->element['localAsValue']) {
            $options['onChange'] = "##STARTFUNC##function(d,s,i) { if (d.length) document.getElementById('" . $this->id . "').value = i.formatDate(d[0].fp_toUTC(), i.config.dateFormat) }##ENDFUNC##";
        }

        $options = str_replace(['"##STARTFUNC##', '##ENDFUNC##"'], "", json_encode($options));
        $options = str_replace('##Q##', '"', $options);
        $options = str_replace('##SLASH##', '/', $options);
        $options = str_replace("\\\\", "\\", $options);

        $js[] = "document.getElementById('" . $this->id . "').flatpickr(" . $options . ");";

        (new RequireJSUtility())
            ->addRequireJSModule("flatpickr", "js/vendor/flatpickr.min")
            ->addDomReadyJS(implode("\n", $js), false, "flatpickr, css!/css/vendor/flatpickr.min.css", false);

        return '<input id="' . $this->id . '" name="' . $this->name . '" type="text"  value="' . htmlspecialchars($this->value, ENT_QUOTES, "UTF-8") . '" ' . $placeholder . $class . '>';

    }
827179
public function inputPrefix()
    {
        if ($this->inputPrefix instanceof Translation) {
            if (isset($this->inputPrefix->isRendered) && $this->inputPrefix->isRendered === false) {
                $this->inputPrefix = $this->renderTranslatableTemplate($this->inputPrefix);
            }

            if ($this->lang()) {
                return $this->inputPrefix[$this->lang()];
            }
        }

        return $this->inputPrefix;
    }
103172
protected function getInput()
	{
		// Initialize variables.
		$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();
		$found = false;

		$html[] = '<ul>';

		// 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"' : '';

			if ($checked)
			{
				$found = true;
			}

			// Add data attributes
			$dataAttributes = '';
			foreach ($option as $field => $value)
			{
				$dataField = strtolower(substr($field, 0, 4));
				if ($dataField == 'data')
				{
					$dataAttributes .= ' ' . $field . '="' . $value . '"';
				}
			}
			// Initialize some JavaScript option attributes.
			$onclick = !empty($option->onclick) ? ' onclick="' . $option->onclick . '"' : '';

			$html[] = '<li>';
			$html[] = '<input type="radio" id="' . $this->id . $i . '" name="' . $this->name . '" value="' . htmlspecialchars($option->value, ENT_COMPAT, 'UTF-8') . '"' . $checked . $class . $onclick . $disabled . $dataAttributes . '/>';
			$html[] = '<label for="' . $this->id . $i . '"' . $class . '>' . App::get('language')->alt($option->text, preg_replace('/[^a-zA-Z0-9_\-]/', '_', $this->fieldname)) . '</label>';
			$html[] = '</li>';
		}

		if ($this->element['option_other'])
		{
			$checked = '';
			if (!$found && $this->value)
			{
				$checked = ' checked="checked"';
			}
			$html[] = '<li>';
			$html[] = '<input type="radio" id="' . $this->id . ($i + 1) . '" name="' . $this->name . '" value=""' . $checked . $class . $onclick . $disabled . '/>';
			$html[] = '<label for="' . $this->id . ($i + 1) . '"' . $class . '>' . App::get('language')->txt('JOTHER') . '</label>';
			$html[] = '<input type="text" id="' . $this->id . '_other" name="' . $this->getName($this->fieldname . '_other') . '" value="' . ($checked ? htmlspecialchars($this->value, ENT_COMPAT, 'UTF-8') : '') . '"' . $class . $onclick . $disabled . '/>';
			$html[] = '</li>';
		}

		$html[] = '</ul>';

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

		return implode($html);
	}
62185
public function makeInput()
    {
        $options = $this->getFormattedOptions();
        $html = '<input'.$this->html->getElementAttributes($options). '>';
        $html = $this->makeElement($options, $html);
        return $html;
    }
543142
public function renderField()
    {
        list($name, $id) = $this->resolveNameID();

        TbArray::defaultValue('id', $id, $this->htmlOptions);
        TbArray::defaultValue('name', $name, $this->htmlOptions);

        TbHtml::addCssClass('bfh-selectbox', $this->wrapperOptions);
        echo CHtml::openTag('div', $this->wrapperOptions);
        if ($this->hasModel()) {
            echo CHtml::activeHiddenField($this->model, $this->attribute, $this->htmlOptions);
            $value = $this->model->{$this->attribute};
            $valueText = $value && isset($this->data[$value]) ? $this->data[$value] : '&nbsp;';
        } else {
            echo CHtml::hiddenField($name, $this->value, $this->htmlOptions);
            $value = $this->value;
            $valueText = $value && isset($this->data[$value]) ? $this->data[$value] : '&nbsp;';
        }

        echo CHtml::openTag(
            'a',
            array(
                'class' => 'bfh-selectbox-toggle',
                'role' => 'button',
                'data-toggle' => 'bfh-selectbox',
                'href' => '#'
            )
        );
        echo CHtml::tag(
            'span',
            array('class' => 'bfh-selectbox-option ' . $this->size, 'data-option' => $value),
            $valueText
        );
        echo CHtml::tag('b', array('class' => 'caret'), '&nbsp;');
        echo CHtml::closeTag('a');

        echo CHtml::openTag('div', array('class' => 'bfh-selectbox-options'));
        if ($this->displayFilter) {
            echo '<input type="text" class="bfh-selectbox-filter">';
        }
        $items = array();
        foreach ($this->data as $key => $item) {
            $items[] = CHtml::tag('a', array('tabindex' => '-1', 'href' => '#', 'data-option' => $key), $item);
        }
        echo CHtml::tag('ul', array('role' => 'options'), '<li>' . implode('</li><li>', $items) . '</li>');
        echo CHtml::closeTag('div');

        echo CHtml::closeTag('div');
    }
613281
public function getInput()
    {
        //fix for https://github.com/atk4/ui/issues/618
        if (isset($this->field)) {
            $value = $this->app->ui_persistence->typecastSaveField($this->field, $this->field->get());
        } else {
            $value = $this->content ?: '';
        }

        return $this->app->getTag('input', [
            'name'        => $this->short_name,
            'type'        => $this->inputType,
            'id'          => $this->id.'_input',
            'value'       => $value,
            'readonly'    => $this->readonly ? 'readonly' : false,
            'disabled'    => $this->disabled ? 'disabled' : false,
        ]);
    }
787360
protected function getInput()
	{
		// Initialize some field attributes.
		$attributes = array(
			'type'         => 'text',
			'name'         => $this->name,
			'id'           => $this->id,
			'class'        => ($this->element['class']     ? (string) $this->element['class']  : ''),
			'cols'         => ($this->element['cols'] ? (int) $this->element['cols'] : ''),
			'rows'         => ($this->element['rows'] ? (int) $this->element['rows'] : ''),
			'disabled'     => ((string) $this->element['disabled'] == 'true'    ? 'disabled' : ''),
			'onchange'     => ($this->element['onchange']  ? (string) $this->element['onchange'] : '')
		);

		$attr = array();
		foreach ($attributes as $key => $value)
		{
			if (!$value)
			{
				continue;
			}

			$attr[] = $key . '="' . $value . '"';
		}
		$attr = implode(' ', $attr);

		return '<textarea ' . $attr . '>' . htmlspecialchars($this->value, ENT_COMPAT, 'UTF-8') . '</textarea>';
	}
551244
public function input() {

		$input  = '';
		$values = (array) $this->get_value();
		$id     = $this->id();

		foreach ( $this->struct['choices'] as $option_value => $option_label ) {
			$sel       = null;
			$option_id = $id . '-' . sanitize_key( $option_value );
			if ( in_array( $option_value, $values ) ) {
				$sel = ' checked="checked"';
			}

			$input .= '<div class="uix-' . esc_attr( $this->type ) . '">';
			$input .= '<label for="' . $option_id . '">';
			$input .= '<input id="' . $option_id . '" ' . $this->build_attributes() . ' value="' . esc_attr( $option_value ) . '"' . $sel . '>';
			$input .= esc_html( $option_label );
			$input .= '</label>';
			$input .= '</div>';
		}

		return $input;
	}
155415
protected function getInput()
	{
		if (empty($this->value))
		{
			// A color field can't be empty, we default to black. This is the same as the HTML5 spec.
			$this->value = '#000000';
		}

		$this->value = '#' . ltrim($this->value, '#');

		// Initialize some field attributes.
		$attributes = array(
			'type'         => 'text',
			'value'        => htmlspecialchars($this->value, ENT_COMPAT, 'UTF-8'),
			'name'         => $this->name,
			'id'           => $this->id,
			'size'         => ($this->element['size']      ? (int) $this->element['size']      : ''),
			'maxlength'    => ($this->element['maxlength'] ? (int) $this->element['maxlength'] : ''),
			'class'        => ($this->element['class']     ? (string) $this->element['class']  : ''),
			'autocomplete' => ((string) $this->element['autocomplete'] == 'off' ? 'off'      : ''),
			'readonly'     => ((string) $this->element['readonly'] == 'true'    ? 'readonly' : ''),
			'disabled'     => ((string) $this->element['disabled'] == 'true'    ? 'disabled' : ''),
			'onchange'     => ($this->element['onchange']  ? (string) $this->element['onchange'] : '')
		);

		if (!$attributes['disabled'])
		{
			Behavior::colorpicker();

			$attributes['class'] .= ' input-colorpicker';
		}

		$attr = array();
		foreach ($attributes as $key => $val)
		{
			if (!$val)
			{
				continue;
			}
			$attr[] = $key . '="' . $val . '"';
		}

		return '<span class="input-color"><input ' . implode(' ', $attr) . ' /></span>';
	}
1338310
public function render()
    {
        $uid = helpers_Random::generateString(24);

        $this->addClass('viewable-hiddenbox-input');
        $this->addAttribute('data-identifier', $uid);

        $value = _dh($this->value);

        $html = <<<HTML
<span class="viewable-hiddenbox">
    {$this->renderLabel()}
    <input type='password' name='{$this->name}' id='{$this->name}' {$this->renderAttributes()} value='{$value}'/>
    <span class="viewable-hiddenbox-toggle" data-identifier="{$uid}"></span>
</span>
HTML;

        $script = <<<SCRIPT
<script type="text/javascript">
    (function() {
        var input = document.querySelector('input[data-identifier="$uid"]'),
            toggle = document.querySelector('.viewable-hiddenbox-toggle[data-identifier="$uid"]'),
            
            iconView = document.createElement('span'),
            iconHide = document.createElement('span');
        
        var show = function() {
            if (iconView.parentElement) {
                toggle.removeChild(iconView);
            }
            if (!iconHide.parentElement) {
                toggle.appendChild(iconHide);
            }
            input.type = 'text';
            input.autocomplete = 'off';
            window.addEventListener('mousedown', autoHide); // make sure always submit the form with an password input
            input.focus();
        };
        
        var hide = function() {
            if (!iconView.parentElement) {
                toggle.appendChild(iconView);
            }
            if (iconHide.parentElement) {
                toggle.removeChild(iconHide);
            }
            input.type = 'password';
            input.autocomplete = 'on';
            window.removeEventListener('mousedown', autoHide);
        };
        
        var autoHide = function(event) {
            if (!event.target.isSameNode(input) && !event.target.isSameNode(iconHide) && !event.target.isSameNode(toggle)) {
                hide();
            }
        };
        
        iconView.classList.add('icon-preview');
        iconHide.classList.add('icon-eye-slash');
        hide();
        
        toggle.addEventListener('click', function() {
            if (input.type === 'password') {
                show();
            } else {
                hide();
            }
        });
    })();
</script>
SCRIPT;

        return (string) ($html . $script);
    }
233793
protected function getInput()
	{
		$html = array();
		$attr = '';

		$select = new HtmlSelect;

		// Try to inject the text object into the field
		try
		{
			$select->setText($this->getText());
		}
		catch (\RuntimeException $exception)
		{
			// A Text object was not set, ignore the error and try to continue processing
		}

		// Initialize some field attributes.
		$attr .= $this->element['class'] ? ' class="' . (string) $this->element['class'] . '"' : '';
		$attr .= ((string) $this->element['disabled'] == 'true') ? ' disabled="disabled"' : '';
		$attr .= $this->element['size'] ? ' size="' . (int) $this->element['size'] . '"' : '';
		$attr .= $this->multiple ? ' multiple="multiple"' : '';

		// Initialize JavaScript field attributes.
		$attr .= $this->element['onchange'] ? ' onchange="' . (string) $this->element['onchange'] . '"' : '';

		// Get the field groups.
		$groups = (array) $this->getGroups();

		// Create a read-only list (no name) with a hidden input to store the value.
		if ((string) $this->element['readonly'] == 'true')
		{
			$html[] = $select->groupedlist(
				$groups,
				null,
				array(
					'list.attr' => $attr, 'id' => $this->id, 'list.select' => $this->value, 'group.items' => null, 'option.key.toHtml' => false,
					'option.text.toHtml' => false
				)
			);
			$html[] = '<input type="hidden" name="' . $this->name . '" value="' . $this->value . '"/>';
		}
		else
		// Create a regular list.
		{
			$html[] = $select->groupedlist(
				$groups,
				$this->name,
				array(
					'list.attr' => $attr, 'id' => $this->id, 'list.select' => $this->value, 'group.items' => null, 'option.key.toHtml' => false,
					'option.text.toHtml' => false
				)
			);
		}

		return implode($html);
	}
643545
public function renderInput()
    {   
        Html::addCssClass($this->_displayOptions, 'element-' . $this->options['id']);
        Html::addCssClass($this->_displayOptions, 'form-control');
        $this->_displayOptions['rows'] = 1;
        $input = Html::activeTextarea($this->model, $this->attribute, $this->_displayOptions);
        echo $input;
    }
428814
public function field()
    {
        $input = new HTMLBrick('input', $this->label, [
            'type'  => $this->type,
            'id'    => $this->id,
            'name'  => $this->name,
            'value' => $this->value,
        ]);
        $input->addClass('form-control');

        return $input;
    }