Эх сурвалжийг харах

Mise en forme formulaire collections

François Drouhard 3 жил өмнө
parent
commit
c9356733b4

+ 2 - 1
src/Form/GenreType.php

@@ -15,7 +15,8 @@ class GenreType extends AbstractType
     public function buildForm(FormBuilderInterface $builder, array $options)
     {
         $builder->add('name', TextType::class, array(
-            'label' =>  false
+            'label'     =>  false,
+            'row_attr'  =>  ['class'    =>  'input-group']
         ));
     }/**
      * {@inheritdoc}

+ 2 - 1
src/Form/RealisateurType.php

@@ -17,7 +17,8 @@ class RealisateurType extends AbstractType
         /*$builder->add('prenom', TextType::class)
                 ->add('nom', TextType::class);*/
         $builder->add('nomComplet', TextType::class, array(
-            'label' => false
+            'label'     => false,
+            'row_attr'  => ['class' =>  'input-group']
         ));
                 //->add('save', SubmitType::class, array ('label' =>  'Enregistrer'));
     }

+ 5 - 5
templates/videotheque/form.html.twig

@@ -24,8 +24,8 @@
                     </div>
                     <div class="card-body">
                         <a href="#" id="add_genre" class="btn btn-link add-another-collection-widget" data-path="{{ path('videotheque_ajax_genres') }}" data-list-selector="#genre-fields-list">Ajouter un genre</a>
-                        <ul id="genre-fields-list" class="form-inline"
-                            data-prototype="{{ form_widget(form.genres.vars.prototype)|e }}"
+                        <ul id="genre-fields-list"
+                            data-prototype='<div id="App_film_genres___name__" class="input-group"><input type="text" id="App_film_genres___name___name" name="App_film[genres][__name__][name]" required="required" /></div>'
                             data-widget-tags="{{ '<li class="list-group-item"></li>'|e }}"
                             data-widget-counter="{{ form.children|length }}">
                             {% for genreField in form.genres %}
@@ -48,18 +48,18 @@
                     </div>
                     <div class="card-body">
                         <a href="#" id="add_realisateur" class="btn btn-link add-another-collection-widget" data-path="{{ path('videotheque_ajax_realisateurs') }}" data-list-selector="#realisateur-fields-list">Ajouter un réalisateur</a>
-                        <ul id="realisateur-fields-list" class="form-inline"
+                        <ul id="realisateur-fields-list"
                             data-prototype="{{ form_widget(form.realisateurs.vars.prototype)|e }}"
                             data-widget-tags="{{ '<li class="list-group-item"></li>'|e }}"
                             data-widget-counter="{{ form.children|length }}">
                             {% for realisateurField in form.realisateurs %}
                             <li class="list-group-item">
-                                {{ form_errors(realisateurField) }}
                                 {{ form_widget(realisateurField) }}
+                                {{ form_errors(realisateurField) }}
                             </li>
                             {% else %}
-                                {{ form_errors(form.realisateurs) }}
                                 {{ form_widget(form.realisateurs) }}
+                                {{ form_errors(form.realisateurs) }}
                             {% endfor %}
                         </ul>
                     </div>