Good all the time of day. I customize a form that is automatically generated using a CRUD generator. I try to put down css styles for the elements added to the form, and generally make it look more decently. Here are the parameters that I feed to the form constructor:

public function buildForm(FormBuilderInterface $builder, array $options) { $builder->add('name') ->add('description') ->add('timeStart', null, ['attr' => [ 'data-style'=>"btn-success", 'class' => 'selectpicker' ] ] ) ->add('timeEnd', null, ['attr' => [ 'data-style'=>"btn-danger", 'class' => 'selectpicker' ] ] ) ->add('parentlist', null, ['attr' => [ 'data-style'=>"btn-primary", 'class' => 'selectpicker' ]] ); } 

The parentlist field is a simple select box that selects the list to which the task belongs. To him, I easily put down the class .selectpicker and the bootstrap plug-in picked it up and reworked it into a beautiful one. And for the timeStart and timeEnd fields is the DateTimeType widget type, and accordingly, the select boxes are added by other separate widgets. And accordingly, when I add the .selectpicker class to these fields, this class goes not to selectboxes, like parentlist, but to the div that unites them all. What should I do to customize select boxes on a regular DateTimeType widget? Maybe for widgets of fields you can edit templates from which they are rendered?

    1 answer 1

    A field with a DateTimeType type has options widget , date_widget and time_widget with which you can set the type of widget to be received (text field, input set, select set).

    In addition, if the standard rendering of the widget does not suit you, you can:

    It will not be possible to give a more detailed answer, as the information provided by you is clearly not enough for this.