yiisoft / yii2

Yii 2: The Fast, Secure and Professional PHP Framework
http://www.yiiframework.com
BSD 3-Clause "New" or "Revised" License
14.24k stars 6.91k forks source link

BaseHtml setActivePlaceholder inconsistent with activeLabel #15740

Closed edwards-sj closed 6 years ago

edwards-sj commented 6 years ago

The setActivePlaceholder method introduced with 2.0.14 is inconsistent with the activeLabel method with regards to attribute names.

What steps will reproduce the problem?

<?= Html::activeTextInput($model, '[0]attribute', ['placeholder' => true]) ?>

What is the expected result?

The placeholder should be the same as the label.

What do you get instead?

Placeholder is the attribute name, [0]attribute

Additional info

activeLabel uses the static method getAttributeName as the input to getAttributeLabel

setActivePlaceholder just passes the attribute name unfiltered.

Q A
Yii version 2.0.14
PHP version 7.1
Operating system Linux
SilverFire commented 6 years ago

Thank you. Would you like to create a PR to fix this issue?