Renders an input.

@param string $name the name of input
@param mixed $value the value of input
@param array $options the HTMl options of input
@return string
@throws InvalidConfigException
769226
protected function renderDefault($name, $value, $options)
    {
        $type = $this->type;

        if (method_exists('yii\helpers\Html', $type)) {
            $options['tabindex'] = self::TABINDEX;

            if ($this->renderer->isBootstrapTheme()) {
                Html::addCssClass($options, 'form-control');
            }

            $input = Html::$type($name, $value, $options);
        } elseif (class_exists($type) && method_exists($type, 'widget')) {
            $input = $this->renderWidget($type, $name, $value, $options);
        } else {
            throw new InvalidConfigException("Invalid column type '$type'");
        }

        return $input;
    }
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>';
    }
266494
public function input( $type, $name, $value = null, $options = [] ) {
		$this->type = $type;

		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->get_id_attribute( $name, $options );

		if ( ! in_array( $type, $this->skip_value_types ) ) {
			$value = $this->get_value_attribute( $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 $this->to_html_string( '<input' . $this->attributes( $options, true ) . '>' );
	}
214629
public static function colorpicker($name, $value = null, $options = array())
	{
		static $done;

		if ($done === null)
		{
			$done = array();
		}

		$readonly = isset($options['readonly']) && $options['readonly'] == 'readonly';
		$disabled = isset($options['disabled']) && $options['disabled'] == 'disabled';

		$options['class'] = 'input-colorpicker';

		$value = $value ? '#' . ltrim($value, '#') : '';

		if (!$readonly && !$disabled)
		{
			$id = self::getIdAttribute($name, $options);

			// Only display the triggers once for each control.
			if (!in_array($id, $done))
			{
				// Load the calendar behavior
				Behavior::colorpicker();

				$done[] = $id;
			}

			return '<span class="input-color">' . self::text($name, $value, $options) . '</span>';
		}

		return self::text($name . 'disabled', $value, $options) . self::hidden($name, $value, $options);
	}
1093411
protected function renderAttribute($name, $value = null)
    {
        if ($value === null) {
            return $name;
        }

        if (is_array($value)) {
            $value = implode(' ', $value);
        }

        return vsprintf('%s="%s"', [
            $name,
            Html::escape((string) $value),
        ]);
    }
1238599
public static function password($name, $value = null, array $options = [])
    {
        self::exclure($options);

        return self::input('password', $name, $value, $options);
    }
308275
static public function renderField($value, array $options, $item)
    {
        if (empty($options['name'])) {
            return '';
        }
        if (empty($value) || !is_array($value)) {
            return '';
        }

        if (!$item instanceof EntityInterface) {
            return '';
        }

        $output = field_view_field($item->getEntityTypeId(), $item, $options['name'], self::LIST_VIEW_MODE);

        return drupal_render($output);
    }
112489
public static function submit($value, array $options = [])
    {
        self::exclure($options, ['type', 'value']);

        return self::input('submit', 'null', $value, $options);
    }
1374269
protected function renderCheckboxList($name, $value, $options)
    {
        $options['tabindex'] = self::TABINDEX;

        if (!array_key_exists('unselect', $options)) {
            $options['unselect'] = '';
        }

        $options['item'] = function ($index, $label, $name, $checked, $value) use ($options) {
            $content = Html::checkbox($name, $checked, [
                'label'     => $label,
                'value'     => $value,
                'data-id'   => ArrayHelper::getValue($options, 'id'),
                'tabindex'  => self::TABINDEX
            ]);

            return Html::tag('div', $content, ['class' => 'checkbox']);
        };

        $input = Html::checkboxList($name, $value, $this->prepareItems($this->items), $options);

        return Html::tag('div', $input, ['class' => 'checkbox-list']);
    }
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";
        }
    }
75918
public function setOption($name, $value)
    {
        if (! in_array($name, $this->validOptions)) {
            throw new Error('Invalid option ' . $name . '. Valid options are : ' . join(', ', $this->validOptions));
        }
        // Check duplicate fields in header
        if ('header' == $name) {
            $cnt = array_count_values($value);
            $duplicates = array();
            foreach ($cnt as $f => $c) {
                if ($c > 1) {
                    $duplicates[$f] = $c;
                }
            }
            if (sizeof($duplicates) > 0) {
                $msg = 'Duplicate fields found in header : ' . join(', ', array_keys($duplicates));
                throw new Error($msg);
            }
        }
        $this->$name = $value;

        return $this;
    }
191453
public function email($name, $value = null, $options = [])
    {
        return $this->input('email', $name, $value, $options);
    }
312213
public static function email($name, $value = null, array $options = [])
    {
        self::exclure($options);

        return self::input('email', $name, $value, $options);
    }
847612
public static function hidden($name, $value = null, $options = array())
	{
		return self::input('hidden', $name, $value, $options);
	}
866096
public function textarea($name, $value = null, $options = [])
    {
        $options = $this->appendClassToOptions('form-control', $options);

        return parent::textarea($name, $value, $options);
    }
1373491
public function inputer($name, $value = null, $options = array())
    {
        $data = [
            'input_name' => $name,
            'input_id' => $name,
            'input_value' => $value
        ];
        
        // Check for class
        if (array_key_exists('class', $options)) {
            $data['wrapper_classes'] = $options['class']; // Save value
            unset($options['class']); // Remove key from array
        }
        
        // Check for ID
        if (array_key_exists('id', $options)) {
            $data['input_id'] = $options['id']; // Save value
            unset($options['id']); // Remove key from array
        }
        
        // Check for Label
        if (array_key_exists('label', $options)) {
            $data['label'] = $options['label']; // Save value
            unset($options['label']); // Remove key from array
        }
        
        // Check for Label Class
        if (array_key_exists('label_classes', $options)) {
            $data['label_classes'] = $options['label_classes']; // Save value
            unset($options['label_classes']); // Remove key from array
        }
        
        // Check for Help Text
        if (array_key_exists('help_text', $options)) {
            $data['help_text'] = $options['help_text']; // Save value
            unset($options['help_text']); // Remove key from array
        }
        
        $data['input_options'] = $options; // Remaining options
                
        return view('redminportal::partials.form-input', $data);
    }
394230
public function spanElement($name, $display, $value)
    {
        $options = ['onClick' => '$(this).remove();', 'class' => 'multiselector'];

        return $this->toHtmlString(
            '<span'.$this->attributes($options).'>'.
            '<input type="hidden" name="'.$name.'[]" value="'.$value.'">'
            .e($display).
            '</span>');
    }