Skip to content

Render form-switch from Tabler #51

Answered by kevinpapst
cavasinf asked this question in Q&A
Discussion options

You must be logged in to vote

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:

            ->add('checkboxSwitch', CheckboxType::class, [
                'required' => false,
                'label_attr' => ['class' => 'checkbox-switch']
            ])

See kevinpapst/TablerBundle-Demo@d0e203c#diff-a03adc7a8da7ae673fbd0fc9d7002fb75ded6663d188b10d25e707b33613aa87R103-R106

Replies: 3 comments 4 replies

Comment options

You must be logged in to vote
3 replies
@cavasinf
Comment options

cavasinf Jan 7, 2022
Collaborator Author

@kevinpapst
Comment options

@cavasinf
Comment options

cavasinf Jan 7, 2022
Collaborator Author

Comment options

cavasinf
Jan 7, 2022
Collaborator Author

You must be logged in to vote
1 reply
@kevinpapst
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by cavasinf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants