diff --git a/framework/CHANGELOG.md b/framework/CHANGELOG.md index d41e805918..5f93bb2470 100644 --- a/framework/CHANGELOG.md +++ b/framework/CHANGELOG.md @@ -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) diff --git a/framework/helpers/BaseHtml.php b/framework/helpers/BaseHtml.php index 430d055012..b38b656aaa 100644 --- a/framework/helpers/BaseHtml.php +++ b/framework/helpers/BaseHtml.php @@ -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); } diff --git a/tests/framework/helpers/HtmlTest.php b/tests/framework/helpers/HtmlTest.php index 91ca85c413..63c286726b 100644 --- a/tests/framework/helpers/HtmlTest.php +++ b/tests/framework/helpers/HtmlTest.php @@ -836,6 +836,13 @@ EOD; ], '', ], + [ + 'some text', + [ + 'value' => 'override text' + ], + '', + ], ]; }