diff --git a/src/bundle/Resources/views/themes/admin/ui/form_fields.html.twig b/src/bundle/Resources/views/themes/admin/ui/form_fields.html.twig index ddd07b245c..a599b77d89 100644 --- a/src/bundle/Resources/views/themes/admin/ui/form_fields.html.twig +++ b/src/bundle/Resources/views/themes/admin/ui/form_fields.html.twig @@ -88,6 +88,13 @@ {%- block _search_content_types_widget -%}
{%- set groups = choices -%} + {%- if terms is defined %} + {%- set groups = choices|ibexa_choices_as_facets( + terms, + (choice, term) => choice.data.identifier == term.getKey().identifier + ) -%} + {%- endif -%} + {%- for group_label, group_choices in groups -%} {% set group_id = group_label|slug %}
@@ -129,7 +136,11 @@ {%- block search_type_choice_widget_options -%}
  • - {{ form_widget(form[choice.value], {'attr': {'data-name': choice.label}, 'label_attr': {'class': 'checkbox-inline'}}) }} + {{ form_widget(form[choice.value], { + 'attr': {'data-name': choice.label}, + 'label': choice.label, + 'label_attr': {'class': 'checkbox-inline'} + }) }}
  • {%- endblock -%} @@ -278,7 +289,14 @@ {%- endblock -%} {%- block _search_section_widget -%} - {{ form_widget(form) }} + {%- if terms is defined %} + {% set choices = choices|ibexa_choices_as_facets( + terms, + (choice, term) => choice.data.id == term.getKey().id + ) %} + {%- endif -%} + + {{ form_widget(form, { choices: choices }) }} {%- endblock -%} {%- block _search_search_language_widget -%} diff --git a/src/bundle/Resources/views/themes/admin/ui/search/filters.html.twig b/src/bundle/Resources/views/themes/admin/ui/search/filters.html.twig index 1ac79ea562..05d0a2b7c7 100644 --- a/src/bundle/Resources/views/themes/admin/ui/search/filters.html.twig +++ b/src/bundle/Resources/views/themes/admin/ui/search/filters.html.twig @@ -1,5 +1,15 @@ {% trans_default_domain 'ibexa_search' %} +{% set content_type_terms = null %} +{% if aggregations is defined and aggregations.has('content_types') %} + {% set content_type_terms = aggregations.get('content_types') %} +{% endif %} + +{% set sections_terms = null %} +{% if aggregations is defined and aggregations.has('sections') %} + {% set sections_terms = aggregations.get('sections') %} +{% endif %} +

    {{ 'search.filters.title'|trans|desc('Filters') }}

    @@ -21,7 +31,10 @@ - {{ form_widget(form.content_types, {'attr': {'class': 'ibexa-filters__select'}}) }} + {{ form_widget(form.content_types, { + 'attr': {'class': 'ibexa-filters__select'}, + 'terms': content_type_terms + }) }}
    @@ -64,7 +77,10 @@ {% if form.section is defined %}
    - {{ form_widget(form.section, {'attr': {'class': 'ibexa-filters__select'}}) }} + {{ form_widget(form.section, { + 'attr': {'class': 'ibexa-filters__select'}, + 'terms': sections_terms + }) }}
    {% endif %}