public function renderInput($name, $options, $contextParams = [])
    {
        if ($this->options instanceof \Closure) {
            $optionsExt = call_user_func($this->options, $this->getModel());
        } else {
            $optionsExt = $this->options;
        }

        $options = ArrayHelper::merge($options, $optionsExt);
        $method = 'render' . Inflector::camelize($this->type);

        // @see https://github.com/unclead/yii2-multiple-input/issues/261
        if (isset($contextParams['index']) && isset($contextParams['indexPlaceholder'])) {
            $options = $this->replaceIndexPlaceholderInOptions($options, $contextParams['indexPlaceholder'], $contextParams['index']);
        }

        $value = null;
        if ($this->type !== self::TYPE_DRAGCOLUMN) {
            $value = $this->prepareValue($contextParams);
        }

        if (isset($options['items'])) {
            $options['items'] = $this->prepareItems($options['items']);
        }

        if (method_exists($this, $method)) {
            $input = $this->$method($name, $value, $options);
        } else {
            $input = $this->renderDefault($name, $value, $options);
        }

        return strtr($this->inputTemplate, ['{input}' => $input]);
    }
public function renderInput($name, $options, $contextParams = [])
    {
        if ($this->options instanceof \Closure) {
            $optionsExt = call_user_func($this->options, $this->getModel());
        } else {
            $optionsExt = $this->options;
        }

        $options = ArrayHelper::merge($options, $optionsExt);
        $method = 'render' . Inflector::camelize($this->type);

        // @see https://github.com/unclead/yii2-multiple-input/issues/261
        if (isset($contextParams['index']) && isset($contextParams['indexPlaceholder'])) {
            $options = $this->replaceIndexPlaceholderInOptions($options, $contextParams['indexPlaceholder'], $contextParams['index']);
        }

        $value = null;
        if ($this->type !== self::TYPE_DRAGCOLUMN) {
            $value = $this->prepareValue($contextParams);
        }

        if (isset($options['items'])) {
            $options['items'] = $this->prepareItems($options['items']);
        }

        if (method_exists($this, $method)) {
            $input = $this->$method($name, $value, $options);
        } else {
            $input = $this->renderDefault($name, $value, $options);
        }

        return strtr($this->inputTemplate, ['{input}' => $input]);
    }
public function renderInput ( $ name , $ options , $ contextParams = [ ] ) { if ( $ this -> options instanceof \ Closure ) { $ optionsExt = call_user_func ( $ this -> options , $ this -> getModel ( ) ) ; } else { $ optionsExt = $ this -> options ; } $ options = ArrayHelper :: merge ( $ options , $ optionsExt ) ; $ method = 'render' . Inflector :: camelize ( $ this -> type ) ; // @see https://github.com/unclead/yii2-multiple-input/issues/261 if ( isset ( $ contextParams [ 'index' ] ) && isset ( $ contextParams [ 'indexPlaceholder' ] ) ) { $ options = $ this -> replaceIndexPlaceholderInOptions ( $ options , $ contextParams [ 'indexPlaceholder' ] , $ contextParams [ 'index' ] ) ; } $ value = null ; if ( $ this -> type !== self :: TYPE_DRAGCOLUMN ) { $ value = $ this -> prepareValue ( $ contextParams ) ; } if ( isset ( $ options [ 'items' ] ) ) { $ options [ 'items' ] = $ this -> prepareItems ( $ options [ 'items' ] ) ; } if ( method_exists ( $ this , $ method ) ) { $ input = $ this -> $ method ( $ name , $ value , $ options ) ; } else { $ input = $ this -> renderDefault ( $ name , $ value , $ options ) ; } return strtr ( $ this -> inputTemplate , [ '{input}' => $ input ] ) ; }
Renders the input.

@param string $name the name of the input
@param array $options the HTML options of input
@param array $contextParams the params who passed to closure:
string $id the id of input element
string $name the name of input element
string $indexPlaceholder The index placeholder of multiple input. The {$indexPlaceholder} template will be replace by $index
int $index The index of multiple input
int $columnIndex The index of current model attributes
@return string
@throws InvalidConfigException
Renders the input .