Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change form in twig input text

Tags:

twig

symfony

i generate new.html.twig by CRUD the file is:

Service creation

{{ form(form) }}

    <ul class="record_actions">
<li>
    <a href="{{ path('service') }}">
        Back to the list
    </a>
</li>

i need him in this form : can someone help me how i can override twig. and think's.

like image 282
razzek Avatar asked Dec 04 '25 01:12

razzek


1 Answers

If you are asking about "how to customize form in symfony2" then here is an excellent article on it. Simplest way to customize part of your form twig, is doing something like it:

{% extends '::base.html.twig' %}

{% form_theme form _self %}

{% block integer_widget %}
    <div class="integer_widget">
        {% set type = type|default('number') %}
        {{ block('form_widget_simple') }}
    </div>
{% endblock %}

{% block content %}
    {# ... render the form #}

    {{ form_row(form.age) }}
{% endblock %}

on the link I provided, there are many examples.

like image 137
pomaxa Avatar answered Dec 06 '25 02:12

pomaxa



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!