protected static function renderRawActiveInput($form, $model, $attribute, $settings)
{
$type = ArrayHelper::getValue($settings, 'type', self::INPUT_TEXT);
$i = strpos($attribute, ']');
$attribName = $i > 0 ? substr($attribute, $i + 1) : $attribute;
if (!in_array($type, static::$_validInputs)) {
throw new InvalidConfigException("Invalid input type '{$type}' configured for the attribute '{$attribName}'.'");
}
$fieldConfig = ArrayHelper::getValue($settings, 'fieldConfig', []);
$options = ArrayHelper::getValue($settings, 'options', []);
$label = ArrayHelper::getValue($settings, 'label', null);
$hint = ArrayHelper::getValue($settings, 'hint', null);
/**
* @var ActiveField $field
*/
$field = $form->field($model, $attribute, $fieldConfig);
if (isset(static::$_basicInputs[$type])) {
return static::getInput($field->{$type}($options), $label, $hint);
}
if ($type === self::INPUT_HIDDEN_STATIC) {
$staticOptions = ArrayHelper::getValue($settings, 'hiddenStaticOptions', []);
return static::getInput($field->staticInput($staticOptions), $label, $hint) . static::getInput($field->hiddenInput($options));
}
if (isset(static::$_dropdownInputs[$type])) {
if (!isset($settings['items'])) {
throw new InvalidConfigException("You must setup the 'items' array for attribute '{$attribName}' since it is a '{$type}'.");
}
return static::getInput($field->{$type}($settings['items'], $options), $label, $hint);
}
if ($type === self::INPUT_CHECKBOX || $type === self::INPUT_RADIO) {
$enclosedByLabel = ArrayHelper::getValue($settings, 'enclosedByLabel', true);
if ($label !== null) {
$options['label'] = $label;
}
return static::getInput($field->{$type}($options, $enclosedByLabel), null, $hint);
}
if ($type === self::INPUT_HTML5) {
$html5type = ArrayHelper::getValue($settings, 'html5type', 'text');
return static::getInput($field->{$type}($html5type, $options), $label, $hint);
}
if ($type === self::INPUT_WIDGET) {
$widgetClass = ArrayHelper::getValue($settings, 'widgetClass', []);
if (empty($widgetClass) && !$widgetClass instanceof InputWidget) {
throw new InvalidConfigException("A valid 'widgetClass' for '{$attribute}' must be setup and extend from 'yii\\widgets\\InputWidget'.");
}
return static::getInput($field->{$type}($widgetClass, $options), $label, $hint);
}
if ($type === self::INPUT_RAW) {
return ArrayHelper::getValue($settings, 'value', '');
}
return null;
}