Fixed yii\helpers\Html::activeTextarea() does not allow value overriding via options

This commit is contained in:
Klimov Paul
2015-05-29 12:31:52 +03:00
parent 22c4de7cdd
commit 0874ffac38
3 changed files with 14 additions and 1 deletions

View File

@ -12,6 +12,7 @@ Yii Framework 2 Change Log
- Bug #8483: sequence name in `Schema::getLastInsertId()` was not properly quoted (nineinchnick)
- Bug #8506: Cleaning of output buffer in `Widget::run()` conflicts with `Pjax` widget which did the cleanup itself (cebe, joester89)
- Bug #8544: Fixed `yii\db\ActiveRecord` does not updates attribute specified at `optimisticLock()` after save (klimov-paul)
- Bug #8585: Fixed `yii\helpers\Html::activeTextarea()` does not allow value overriding via options (klimov-paul)
- Bug: Fixed string comparison in `BaseActiveRecord::unlink()` which may result in wrong comparison result for hash valued primary keys starting with `0e` (cebe)
- Bug: Pass correct action name to `yii\console\Controller::options()` when default action was requested (cebe)
- Bug: Automatic garbage collection in `yii\caching\FileCache` was not triggered (kidol)

View File

@ -1331,7 +1331,12 @@ class BaseHtml
public static function activeTextarea($model, $attribute, $options = [])
{
$name = isset($options['name']) ? $options['name'] : static::getInputName($model, $attribute);
$value = static::getAttributeValue($model, $attribute);
if (isset($options['value'])) {
$value = $options['value'];
unset($options['value']);
} else {
$value = static::getAttributeValue($model, $attribute);
}
if (!array_key_exists('id', $options)) {
$options['id'] = static::getInputId($model, $attribute);
}

View File

@ -836,6 +836,13 @@ EOD;
],
'<textarea id="htmltestmodel-description" name="HtmlTestModel[description]" maxlength="99">some text</textarea>',
],
[
'some text',
[
'value' => 'override text'
],
'<textarea id="htmltestmodel-description" name="HtmlTestModel[description]">override text</textarea>',
],
];
}