Skip to content

Instantly share code, notes, and snippets.

@leevigraham
Forked from tentacode/form.html.twig
Created July 25, 2014 07:46
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save leevigraham/f1bd326499eb35926df6 to your computer and use it in GitHub Desktop.
Save leevigraham/f1bd326499eb35926df6 to your computer and use it in GitHub Desktop.
{% macro form_fields(form) %}
{% for field in form %}
{% if field.vars.block_prefixes[0] != 'button' %}
{{ form_row(field) }}
{% endif %}
{% endfor %}
{% endmacro %}
{% import _self as macros %}
<form class="form-horizontal" method="post" action="{{ path('foo_bar') }}" {{ form_enctype(form) }}>
{{ macros.form_fields(form) }}
<div class="form-actions">
<p>
{{ form_widget(form.submit) }}
</p>
</div>
{{ form_rest(form) }}
</form>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment