rkl / autocomplete-for-indexedsearch
Adds autocomplete functionality to the TYPO3 indexed search field.
Installs: 157
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 0
Type:typo3-cms-extension
Requires
- typo3/cms-core: ^12.4 || ^13.4
- typo3/cms-extbase: ^12.4 || ^13.4
- typo3/cms-fluid: ^12.4 || ^13.4
- typo3/cms-frontend: ^12.4 || ^13.4
- typo3/cms-indexed-search: ^12.4 || ^13.4
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.65
- helmich/typo3-typoscript-lint: ^3.2
- saschaegerer/phpstan-typo3: ^1.10
README
TYPO3 Extension: Autocomplete for IndexedSearch
This extension adds autocomplete functionality to TYPO3 indexed search fields.
Features
- Supports TYPO3 12 and 13
- No further dependencies
- Comes with limited styling for easy customizability
Installation
The recommended way to install Autocomplete for IndexedSearch is by using Composer:
composer require rkl/autocomplete-for-indexedsearch
Setup
1. Include the static TypoScript of the extension
- Go to Site Management -> TypoScript
- Open your TypoScript template and click "Edit the whole TypoScript record"
- In the tab "Advanced Options", include the TypoScript set: "Autocomplete for Indexed Search (autocomplete_for_indexedsearch)"
2. Override the Form.html template from indexed_search
- Copy the partial from
EXT:indexed_search/Resources/Private/Partials/Form.html
to your own site package, for example toEXT:my_sitepackage/Resources/Private/IndexedSearch/Partials/Form.html
- Add your partial root path to the plugin configuration of Indexed Search in the TypoScript of your site package:
plugin {
tx_indexedsearch {
view {
partialRootPaths.200 = EXT:site_package/Resources/Private/IndexedSearch/Partials/
}
}
}
3. Place the ViewHelper to render suggestions
Add the ViewHelper <rkl:autocompleteSuggestions />
to your overridden Form.html
. It renders the container in which suggestions will be displayed.
<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers" xmlns:rkl="http://typo3.org/ns/RKL/AutocompleteForIndexedSearch/ViewHelpers" data-namespace-typo3-fluid="true" > <!-- ... --> <rkl:autocompleteSuggestions searchonclick="0" minlength="2" />
Add the ViewHelper wherever it suits your styling needs the best. Ideally it's placed close to the search field. Also remember to add the namespace RKL/AutocompleteForIndexedSearch/ViewHelpers
like shown in the example.
ViewHelper attributes
The autocompleteSuggestions
ViewHelper provides the following attributes to manipulate the behavior of the autocomplete suggestions:
Attribute | Allowed values | Description |
---|---|---|
searchonclick | bool (0 /1 ) |
defines whether to instantly submit the search form when a suggestion is clicked |
minlength | int | minimum string length of the search term for autocompletion to start |
Optional: Add a Route Enhancer
For prettier autocomplete URLs you can add the autocomplete page type to your routeEnhancers:
routeEnhancers: PageTypeSuffix: type: PageType index: '' map: search-autocomplete: 7603976
Links
Sponsorships
PayPal: www.paypal.me/rukling