php - Twig block calling with parameters -
i kinda new symfony , twig. trying 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 know, block can defined , used in other part of template
{% block fooblock %} // block body {% endblock %}
when parameters passed into, macro should rather used
{% macro barmarco(param1, param2, param3) %} // macro body using param1, param2, param3 etc, {% endmacro %}
in mentioned above file found like. definition of block:
{%- block form_errors -%} {%- if errors|length > 0 -%} <ul> {%- 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 question: why block called param (form)
. thought macro should invoked this?
Comments
Post a Comment