-
-
Notifications
You must be signed in to change notification settings - Fork 106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ActiveField::staticControl inputOptions #168
Comments
Thanks for posting in our issue tracker.
Thanks! This is an automated comment, triggered by adding the label |
The ActiveField::staticControl method lost values of ActiveField::inputOptions. This cause problem, for example we have an ActiveField: $field = $form->field($model, $attribute, [
'inputOptions' => ['class' => 'my-class']
]); But when rendering it lost inputOptions: echo $field->staticControl(); All other similar methods of \yii\widget\ActiveField has that behavior: public function input($type, $options = [])
{
$options = array_merge($this->inputOptions, $options); public function textInput($options = [])
{
$options = array_merge($this->inputOptions, $options); public function hiddenInput($options = [])
{
$options = array_merge($this->inputOptions, $options); public function passwordInput($options = [])
{
$options = array_merge($this->inputOptions, $options); public function fileInput($options = [])
{
if ($this->inputOptions !== ['class' => 'form-control']) {
$options = array_merge($this->inputOptions, $options); public function textarea($options = [])
{
$options = array_merge($this->inputOptions, $options); and so on ... So, staticControl() must not lost values, configured in inputOptions too. It's a bug. |
Similar issue for other methods: |
I don't think it makes sense to copy the general "input options" to static control too. It has other classes and properties: |
For what other purposes and scenarios is this field intended and can be used? ActiveField renderer only by one of methods - textField or staticField or anothe. ActiveField instance not using many times with different input rendering. So, all it data intended to be used just for one purpose - rendering field. I'm usng ActiveField in my library and all workng fine except the staticControl, which, unlike other methods, loses and does not take into account the parameters. This is an obvious bug. Other properties (like readonly="true") must be added to options by staticControl, as other method does. |
No the static control is not like other fields. It's not just the readonly property, it has other classes and just exists in bootstrap library because it just exists in bootstrap framework. It makes no sense to copy all the options from default inputs and have to unset them in the |
Missing inputOptions in \yii\bootstrap4\ActiveField::staticControl
Yii version - 2.0.23
yiisoft/yii2-bootstrap4 - 2.0.6
The text was updated successfully, but these errors were encountered: