Render form-switch
from Tabler
#51
-
@kevinpapst have you ever try to do a switch input from Tabler?
Look's like simple, How it should look: <label class="form-check form-switch">
<input class="form-check-input" type="checkbox">
<span class="form-check-label">Can connect</span>
</label> What I've tried: <label class="form-check form-switch">
{{ form_label(form.canConnect) }}
{{ form_widget(form.canConnect) }}
{{ form_errors(form.canConnect) }}
</label> How it render from twig: <label class="form-check form-switch">
<div class="form-check"> <!-- WRONG !!! -->
<input type="checkbox" class="form-check-input">
<label class="form-check-label">Can connect</label>
</div>
</label> |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 4 replies
-
No, haven't tried yet and honestly: form themes are one of the biggest pain points (besides the security system) in Symfony 👿 |
Beta Was this translation helpful? Give feedback.
-
Covid ? |
Beta Was this translation helpful? Give feedback.
-
The solution is deep hidden in the Symfony code, sometimes a look into the base code is good: It already works when you define the switch like that:
|
Beta Was this translation helpful? Give feedback.
The solution is deep hidden in the Symfony code, sometimes a look into the base code is good:
Check this file: vendor/symfony/twig-bridge/Resources/views/Form/bootstrap_5_layout.html.twig
It already works when you define the switch like that:
See kevinpapst/TablerBundle-Demo@d0e203c#diff-a03adc7a8da7ae673fbd0fc9d7002fb75ded6663d188b10d25e707b33613aa87R103-R106