Skip to content

Commit

Permalink
Manual rendering documentation (#5)
Browse files Browse the repository at this point in the history
* Manual rendering documentation

Added few words about manual form rendering

* Update rendering.md
  • Loading branch information
DepkaCZ authored and enumag committed Sep 4, 2018
1 parent a5698d4 commit 05072b1
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions docs/rendering.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,23 @@ class CustomForm extends Control
}
```

Full manual rendering of forms with form-specific themes
----

If you want to have full control of form rendering (e.g. render only some form fields) using custom themes you should do it in blocks. Block for the 1st level form is named 'form'. This differs a bit from original Symfony documentation, because everything outside of block structure will NOT be rendered.

Example of `form-specific-template.twig`:
```
{% use 'bootstrap_4_horizontal_layout.html.twig' %}
{% block form %}
{{ form_start(form, {'method': 'GET'}) }}
<div class="col-lg-6">
{{ form_row(form.username) }}
</div>
{# don't render unrendered fields #}
{{ form_end(form, {'render_rest': false}) }}
{% endblock %}
```

Latte macros
----
Expand Down

0 comments on commit 05072b1

Please sign in to comment.