-
Notifications
You must be signed in to change notification settings - Fork 297
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
Overriding default config doesn't work (radio) #537
Comments
How are you setting up the radio button? |
In my form class I create multiple radio buttons like this ->
And call them to the view ->
|
Why are you using |
Tested using |
Maybe use |
(I love how the no/yes options are 0/2 and not 0/1 =) Was 1 taken?) |
Hi, classes that I define in the widget inside the view are working :) It's the defaults for 'radio' in config/laravel-form-builder.php that don't seem to get applied. (Sidenote: the 'yes' option gets value 2 because I have to build up a binary value with multiple radio buttons due to the pre-existing database structure, so to answer that question: yes 1 was already taken :) ) |
Yes, that's why you should use |
Using |
Any progress on this? I'm running into exactly the same issue. |
I have the same issue. Default configurations are never applied to the choices field item. <?php
return [
'defaults' => [
....
'radio' => [
'choice_options' => [
'field' => 'form-radio',
],
],
....
],
]; Looking into the source code, you can see that these configurations will never be read ( src/Kris/LaravelFormBuilder/Fields/ChoiceType.php <?php
namespace Kris\LaravelFormBuilder\Fields;
class ChoiceType extends ParentType
{
...
protected function setDefaultClasses(array $options = [])
{
...
$choice_wrapper_class = $this->formHelper->getConfig('defaults.' . $this->type . '.choice_options.wrapper_class', '');
$choice_label_class = $this->formHelper->getConfig('defaults.' . $this->type . '.choice_options.label_class', '');
$choice_field_class = $this->formHelper->getConfig('defaults.' . $this->type . '.choice_options.field_class', '');
...
}
...
} |
I don't use the choice types. If you make a PR, all my bonus points are yours. |
For update : It seems that the configuration (or the code) isn't correct. So, we should have in the config file :
or maybe edit the |
@stfr That sounds smart. You should PR that. |
Stepping through the code with a debugger shows that these default values are being picked up, however it is not working for the radio button
The text was updated successfully, but these errors were encountered: