V
V
vladislav9972021-06-22 11:27:21
symfony
vladislav997, 2021-06-22 11:27:21

How to customize the time type in a form?

Can you tell me how to customize the time type in a Symfony form?

Twig:

{{ form_label(form.sending_value, 'Во сколько', {'label_attr': {'class': 'uk-form-label'}}) }}
{{ form_widget(form.sending_value, {'attr': {'class': ''}}) }}


FormType: How it all appears on the front:
->add('sending_value')


<div id="section_sending_value" class="">
        <select id="section_sending_value_hour" name="section[sending_value][hour]">
            ...
        </select>
        :
        <select id="section_sending_value_minute" name="section[sending_value][minute]">
            ...
        </select>
</div>

and how to set one class to these two selects? Since the above in the twig example - does not work

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
sl0, 2021-06-22
@sl0

Here you can see the options

D
Dobroe3lo, 2021-06-23
@Dobroe3lo

Declare that you will use your theme in the given twig

{# имппортирует "_self" в качестве темы формы #}
{% form_theme form _self %}

and then:
{# настроить фрагмент формы #}
{% block form_row %}
    {# вывод строки пользователького поля #}
{% endblock form_row %}

Docks

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question