Skip to content

Commit

Permalink
[FEATURE] Add an option to preselect fulltext search as default (#905)
Browse files Browse the repository at this point in the history
Co-authored-by: Michael Kubina <[email protected]>
Co-authored-by: Sebastian Meyer <[email protected]>
  • Loading branch information
3 people committed May 24, 2023
1 parent 09156ea commit 254a66a
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 5 deletions.
10 changes: 10 additions & 0 deletions Configuration/FlexForms/Search.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,16 @@
</config>
</TCEforms>
</settings.fulltext>
<settings.fulltextPreselect>
<TCEforms>
<exclude>1</exclude>
<label>LLL:EXT:dlf/Resources/Private/Language/locallang_be.xlf:plugins.search.flexform.fulltextPreselect</label>
<config>
<type>check</type>
<default>0</default>
</config>
</TCEforms>
</settings.fulltextPreselect>
<settings.datesearch>
<TCEforms>
<exclude>1</exclude>
Expand Down
14 changes: 14 additions & 0 deletions Documentation/Plugins/Index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -700,6 +700,20 @@ Search
:ref:`t3tsref:data-type-boolean`
:Default:

- :Property:
fulltextPreselect
:Data Type:
:ref:`t3tsref:data-type-boolean`
:Default:
0

- :Property:
datesearch
:Data Type:
:ref:`t3tsref:data-type-boolean`
:Default:
0

- :Property:
solrcore
:Data Type:
Expand Down
6 changes: 5 additions & 1 deletion Resources/Private/Language/de.locallang_be.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,11 @@
</trans-unit>
<trans-unit id="plugins.search.flexform.fulltext" approved="yes">
<source><![CDATA[Enable full text search?]]></source>
<target><![CDATA[Volltext-Suche aktivieren?]]></target>
<target><![CDATA[Volltextsuche aktivieren?]]></target>
</trans-unit>
<trans-unit id="plugins.search.flexform.fulltextPreselect" approved="yes">
<source><![CDATA[Preselect full text search?]]></source>
<target><![CDATA[Volltextsuche vorauswählen?]]></target>
</trans-unit>
<trans-unit id="plugins.search.flexform.datesearch" approved="yes">
<source><![CDATA[Enable date search?]]></source>
Expand Down
3 changes: 3 additions & 0 deletions Resources/Private/Language/locallang_be.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@
<trans-unit id="plugins.search.flexform.fulltext">
<source><![CDATA[Enable full text search?]]></source>
</trans-unit>
<trans-unit id="plugins.search.flexform.fulltextPreselect">
<source><![CDATA[Preselect full text search?]]></source>
</trans-unit>
<trans-unit id="plugins.search.flexform.datesearch">
<source><![CDATA[Enable date search?]]></source>
</trans-unit>
Expand Down
20 changes: 16 additions & 4 deletions Resources/Private/Templates/Search/Main.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,22 @@

<!-- Fulltext switch -->
<f:if condition="{settings.fulltext}">
<f:form.radio property="fulltext" value="0" id="tx-dlf-search-fulltext-no-{viewData.uniqueId}" class="tx-dlf-search-fulltext" checked="{lastSearch.fulltext} == 0" />
<label for="tx-dlf-search-fulltext-no-{viewData.uniqueId}"><f:translate key="search.inMetadata"/></label>
<f:form.radio property="fulltext" value="1" id="tx-dlf-search-fulltext-yes-{viewData.uniqueId}" class="tx-dlf-search-fulltext-yes" checked="{lastSearch.fulltext} == 1" />
<label for="tx-dlf-search-fulltext-yes-{viewData.uniqueId}"><f:translate key="search.inFulltext"/></label>
<f:comment><!-- needs to be written like this, to check if fulltext searchparam == NULL --></f:comment>
<f:if condition="{lastSearch.fulltext} ==">
<f:then>
<f:form.radio property="fulltext" value="0" id="tx-dlf-search-fulltext-no-{viewData.uniqueId}" class="tx-dlf-search-fulltext" checked="{settings.fulltextPreselect} == 0" />
<label for="tx-dlf-search-fulltext-no-{viewData.uniqueId}"><f:translate key="search.inMetadata"/></label>
<f:form.radio property="fulltext" value="1" id="tx-dlf-search-fulltext-yes-{viewData.uniqueId}" class="tx-dlf-search-fulltext-yes" checked="{settings.fulltextPreselect} == 1" />
<label for="tx-dlf-search-fulltext-yes-{viewData.uniqueId}"><f:translate key="search.inFulltext"/></label>
</f:then>
<f:comment><!-- as soon we have a user preference, we use it instead --></f:comment>
<f:else>
<f:form.radio property="fulltext" value="0" id="tx-dlf-search-fulltext-no-{viewData.uniqueId}" class="tx-dlf-search-fulltext" checked="{lastSearch.fulltext} == 0" />
<label for="tx-dlf-search-fulltext-no-{viewData.uniqueId}"><f:translate key="search.inMetadata"/></label>
<f:form.radio property="fulltext" value="1" id="tx-dlf-search-fulltext-yes-{viewData.uniqueId}" class="tx-dlf-search-fulltext-yes" checked="{lastSearch.fulltext} == 1" />
<label for="tx-dlf-search-fulltext-yes-{viewData.uniqueId}"><f:translate key="search.inFulltext"/></label>
</f:else>
</f:if>
</f:if>

<f:comment><!-- Add list of collections as parameter when configured in search plugin --></f:comment>
Expand Down

0 comments on commit 254a66a

Please sign in to comment.