4 use Symfony Form Type 4 and Bootstrap how to use GRID?

0 like 0 dislike
56 views
Good afternoon, I have a question about Forms in the Symphony.
Created The Form:

File: register_content.html.twig
{% trans_default_domain 'FOSUserBundle' %} {{ form_start(form, {'method': 'post', 'action': path('fos_user_registration_register'), 'attr': {'class': 'fos_user_registration_register'}}) }} {{ form_widget(form, {'attr': {'class': 'form-row'}}) }} {{ form_end(form) }}


File: twig.yaml:
form_themes: ['bootstrap_4_layout.html.twig']

File: RegistrationFormType.php
public function buildForm(FormBuilderInterface $builder, array $options) { $builder ->add('sex', ChoiceType::class, array( 'label_attr' => array( 'class' => 'radio-inline' ), 'choices' => array( 'form.Mrs' => 'Mrs', 'form.Mr' => 'Mr', ), 'multiple' => false, 'expanded' => true, 'translation_domain' => 'FOSUserBundle', 'label' => 'form.sex' )) ->add('firstName', TextType::class, array( 'label' => 'form.firstName', 'translation_domain' => 'FOSUserBundle')) ->add('lastName', TextType::class, array( 'label' => 'form.lastName', 'translation_domain' => 'FOSUserBundle')); }


etc.......


like something you can mount the mesh? to get something like this: ?
Thanks in advance
by | 56 views

1 Answer

0 like 0 dislike
Yes, you will need to create your own theme in which to override form_row widget. For more information, see here: symfony.com/doc/current/form/form_customization.html

\rsymnoob, There is exactly your case when you have to add a css class: symfony.com/doc/current/form/form_customization.ht...

Then you have two options: symfony.com/doc/current/form/form_customization.ht...

If you are in different places need different classes, it is better to just do everything manually: https://symfony.com/doc/current/form/rendering.htm...
by

Related questions

0 like 0 dislike
1 answer
asked Apr 14, 2019 by Programmir
0 like 0 dislike
1 answer
0 like 0 dislike
2 answers
0 like 0 dislike
2 answers
110,608 questions
257,186 answers
0 comments
33,896 users