Skip to content
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

radioList doesn't respect radioTemplate option #199

Open
DmLapin opened this issue Sep 8, 2020 · 0 comments
Open

radioList doesn't respect radioTemplate option #199

DmLapin opened this issue Sep 8, 2020 · 0 comments
Labels
status:to be verified Needs to be reproduced and validated. type:docs Documentation

Comments

@DmLapin
Copy link

DmLapin commented Sep 8, 2020

What steps will reproduce the problem?

In my container I set this definition:

'definitions' => [
    'radioOptions' => [
        'class' => ['widget' => 'form-check-input'],
        'labelOptions' => [
            'class' => ['widget' => 'form-check-label']
        ],
    ],
    'radioTemplate' => "<div class=\"form-check\">\n{input}\n{label}\n{error}\n{hint}\n</div>",
]

In my view:

$activeForm->field($someForm, 'someField')->radioList($someValues);

What's expected?

<div role="radiogroup">
    <div class="form-check">
        <input type="radio" id="i0" class="form-check-input" name="SomeForm[someField]" value="1">
        <label class="form-check-label" for="i0">Label 1</label>
    </div>

    <div class="form-check">
        <input type="radio" id="i1" class="form-check-input" name="SomeForm[someField]" value="2">
        <label class="form-check-label" for="i1">Label 2</label>
    </div>
...
</div>

What do you get instead?

<div role="radiogroup">
    <div class="custom-control custom-radio">
        <input type="radio" id="i0" class="form-check-input" name="SomeForm[someField]" value="1">
        <label class="form-check-label" for="i0">Label 1</label>
    </div>

    <div class="custom-control custom-radio">
        <input type="radio" id="i1" class="form-check-input" name="SomeForm[someField]" value="2">
        <label class="form-check-label" for="i1">Label 2</label>
    </div>
...
</div>

Additional info

Same thing with checkboxList. Yes, I have found in code magic 'wrapperOptions', on vendor/yiisoft/yii2-bootstrap4/src/ActiveField.php:381 but:

  1. No mention about it in phpdoc for $radioOptions.
  2. Why should I configure radios & checkboxes layout twice?

Maybe it's not bug, but doc problem.

@bizley bizley added status:to be verified Needs to be reproduced and validated. type:docs Documentation labels Sep 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status:to be verified Needs to be reproduced and validated. type:docs Documentation
Projects
None yet
Development

No branches or pull requests

2 participants