Reputation: 609
i generate new.html.twig by CRUD the file is:
{{ 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.
Upvotes: 3
Views: 3103
Reputation: 626
<form action="$" method="POST" class="form-horizontal form-bordered">
<div class="control-group">
<label for="textfield" class="control-label">Brand Name</label>
<div class="controls">
{{ form_widget(form.brandName,{'attr':{'class':'input-xlarge','data-rule-required':'true'} }) }}
</div>
</div>
<div class="form-actions">
{{ form_widget(form.submit,{'attr':{'class':'btn btn-primary','value':'Save changes'} }) }}
</div>
{{ form_rest(form) }}
</form>
Upvotes: 0
Reputation: 1746
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.
Upvotes: 1