mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-03 22:32:40 +08:00
Fixed yii\helpers\Html::activeTextarea() does not allow value overriding via options
This commit is contained in:
@ -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)
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
@ -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>',
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user