vubi vubi - 7 months ago 78
Twig Question

Symfony from styling time widgets

I am currently trying to style a form that is generated by symfony form builder.

there is a bootstrap overlay on it but i want to move the time widgets so they align next to each other.

form view

twig template rows


You can display each input of your form independently using


form_row is the combination of the field's label, errors and widget.

You can see the doc about this


So if you want to display some widgets in one line you can do this (you have to use a loop to display each input of your form collection) :

<style type="text/css">
         display: inline-block;

<div class='myClass'>
  {% for business in form.businesshours %}
      <div class="inline">{{ form_row( }}</div>
      <div class="inline">{{ form_row(business.openTime) }}</div>
      <div class="inline">{{ form_row(business.breakStart) }}</div>
      <div class="inline">{{ form_row(business.breakEnd) }}</div>
      <div class="inline">{{ form_row(business.closeTime) }}</div>
  {% endfor %}