mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-02 13:02:24 +08:00
Adds ability for the user to choose if they want to double encode entities within textareas or not when using ActiveForm. Applies enhancement from #12988.
This commit is contained in:
committed by
SilverFire - Dmitry Naumenko
parent
457e9241e3
commit
10ad620cb4
@ -660,12 +660,19 @@ class BaseHtml
|
||||
* the attributes of the resulting tag. The values will be HTML-encoded using [[encode()]].
|
||||
* If a value is null, the corresponding attribute will not be rendered.
|
||||
* See [[renderTagAttributes()]] for details on how attributes are being rendered.
|
||||
* The following special options are recognized:
|
||||
*
|
||||
* - `doubleEncode`: whether to double encode HTML entities in `$value`. If `false`, HTML entities in `$value` will not
|
||||
* be further encoded. This option is available since version 2.0.11.
|
||||
*
|
||||
* @return string the generated text area tag
|
||||
*/
|
||||
public static function textarea($name, $value = '', $options = [])
|
||||
{
|
||||
$options['name'] = $name;
|
||||
return static::tag('textarea', static::encode($value), $options);
|
||||
// Get value, then remove from array - not needed for `renderTagAttributes` called inside the `tag` method
|
||||
$doubleEncode = ArrayHelper::remove($options, 'doubleEncode', true);
|
||||
return static::tag('textarea', static::encode($value, $doubleEncode), $options);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user