ui2022/table--search.html.twig line 16

Open in your IDE?
  1. {# the html form view for the search form; expected to be of a SearchForm type #}
  2. {% set form = _args.form %}
  3. {% set headers = _args.headers %}
  4. {% set pagination = _args.pagination|default(null) %}
  5. {# use search form vars to generate sort data for the given headers  #}
  6. {% set headers = headers|map((header) => header|merge({
  7.     sort: (header.sort is defined and header.sort in form.vars.sorts) ? {
  8.         key: header.sort,
  9.         dir: (form.sort.vars.value is same as(header.sort)) ? form.direction.vars.value|dir_flip : form.vars.dirs[header.sort],
  10.         active: (form.sort.vars.value is same as(header.sort)),
  11.     } : null,
  12. })) %}
  13. {# render the content of the table; due to complexities with twig it needs done this way #}
  14. {% set content = (block('items') is defined) ? block('items') : null %}
  15. {# embed the sortable table view #}
  16. {% embed '@ui2022/table--sortable.html.twig' with {
  17.     form: form,
  18.     sort_input: form.sort,
  19.     dir_input: form.direction,
  20.     header: {
  21.         labels: headers,
  22.     },
  23. } %}
  24.     {% block items %}
  25.         {{ content|raw }}
  26.     {% endblock %}
  27. {% endembed %}
  28. {# add pagination if it is given #}
  29. {% if pagination %}
  30.     {% include '@ui2022/pagination.html.twig' with pagination %}
  31. {% endif %}