Closed PMan2 closed 8 years ago
When you want to turn off animation, you can set 'animate' attribute in 'pluginOptions' to false:
echo $form->field($model, 'status')->widget(SwitchInput::classname(), [ 'pluginOptions' => [ 'animate' => false ] ]);
But it's not working, animate is still set to true in web page source code
<script type="text/javascript"> var bootstrapSwitch_29bf9f81 = {"animate":true,"indeterminate":false,"disabled":false,"readonly":false}; </script>
It's because you are using empty() PHP function to check, whether value of 'animate' is valid:
empty()
// SwitchInput.php, row 188 if (empty($this->pluginOptions['animate'])) { $this->pluginOptions['animate'] = true; }
Problem is that empty() returns true also on boolean value false of 'animate', I suggest additional test whether value is type of boolean or not:
false
// SwitchInput.php, row 188 (FIXED) if (empty($this->pluginOptions['animate']) && !is_bool($this->pluginOptions['animate'])) { $this->pluginOptions['animate'] = true; }
After this fix it's working correctly. Thanks for your cool plugins!
When you want to turn off animation, you can set 'animate' attribute in 'pluginOptions' to false:
But it's not working, animate is still set to true in web page source code
It's because you are using
empty()
PHP function to check, whether value of 'animate' is valid:Problem is that
empty()
returns true also on boolean valuefalse
of 'animate', I suggest additional test whether value is type of boolean or not:After this fix it's working correctly. Thanks for your cool plugins!