Files
myep/templates/_partials/_query_passthrough.html.twig
T

18 lines
689 B
Twig

{#
Renders query parameters as hidden inputs so they survive a filter submit.
A filter form only submits its own fields, so anything else that describes the current list —
the sorting, the page size, the return URL — has to be carried along explicitly or it is lost
the moment somebody searches.
#}
{% macro render(values, prefix) %}
{%- for key, value in values -%}
{%- set name = prefix ? prefix ~ '[' ~ key ~ ']' : key -%}
{%- if value is iterable -%}
{{ _self.render(value, name) }}
{%- else -%}
<input type="hidden" name="{{ name }}" value="{{ value }}">
{%- endif -%}
{%- endfor -%}
{% endmacro %}