I am kinda new to Symfony and Twig. I am trying to override default Twig form template in vendor\symfony\symfony\src\Symfony\Bridge\Twig\Resources\views\Form\form_div_layout.html.twig (Symfony 3.2.6)
As far as I know, block can be defined and then used in other part of template
{% block fooBlock %}
// the block body
{% endblock %}
When parameters are to be passed into, a macro should be rather used
{% macro barMarco(param1, param2, param3) %}
// macro body using param1, param2, param3 etc,
{% endmacro %}
In mentioned above file i found something like. this The definition of block:
{%- block form_errors -%}
{%- if errors|length > 0 -%}
<ul>
{%- for error in errors -%}
<li>{{ error.message }}</li>
{%- endfor -%}
</ul>
{%- endif -%}
{%- endblock form_errors -%}
And usage:
{%- block form_row -%}
<div>
{{- form_label(form) -}}
{{- form_errors(form) -}}
{{- form_widget(form) -}}
</div>
{%- endblock form_row -%}
And here's the question: why this block it called with param (form)
. I thought a macro should be invoked like this?