teaminmedias-pluswerk / ke_search

Search Extension for TYPO3 Content Management System, including faceting search functions.
https://extensions.typo3.org/extension/ke_search/
GNU General Public License v3.0
35 stars 62 forks source link

[TASK] Allow filters to be rendered in ResultList #428

Closed mikestreety closed 3 years ago

mikestreety commented 3 years ago

Adds the option to include the Filters partial in the the ResultList plugin

I wanted to add the link filters to the right-hand side of the search (Like this - note: not using ke_search).

Calling this method inside the getSearchResults method, means I can use a custom filter partial to only show the link filters if present

christianbltr commented 3 years ago

That looks like a nice enhancement. Could you post a snippet how you include the filters in the result list fluid template? I would like to add it to the documentation.

mikestreety commented 3 years ago

Of course.

I made a Resources/Private/Partials/FiltersForm.html which is a modification of the Filters.html which looks like:

<f:for each="{filters}" as="filter">
    <f:switch expression="{filter.rendertype}">
        <f:case value="select"><f:render partial="Filters/Select" arguments="{conf: conf, filter: filter}" /></f:case>
        <f:case value="checkbox"><f:render partial="Filters/Checkbox" arguments="{conf: conf, filter: filter}" /></f:case>
    </f:switch>
</f:for>

There is also a Resources/Private/Partials/FiltersResults.html which contains:

<f:for each="{filters}" as="filter">
    <f:switch expression="{filter.rendertype}">
        <f:case value="list"><f:render partial="Filters/List" arguments="{conf: conf, filter: filter}" /></f:case>
        <f:case value="custom"><f:format.raw>{filter.rawHtmlContent}</f:format.raw></f:case>
    </f:switch>
</f:for>

In Resources/Private/Templates/ResultList.html I then included:

<f:if condition="{filters}">
    <div class="filters filtersResults">
        <f:render partial="FiltersResults" arguments="{conf: conf, numberofresults: numberofresults, resultrows: resultrows, filters: filters}" />
    </div>
</f:if>

And in Resources/Private/Templates/SearchForm.html I included:

<f:if condition="{filters}">
    <div class="filters filtersForm">
        <f:render partial="FiltersForm" arguments="{conf: conf, numberofresults: numberofresults, resultrows: resultrows, filters: filters}" />
    </div>
</f:if>

Hope that all makes sense!

christianbltr commented 3 years ago

Thank you.