Klaus

Configuring Suggest Wizard through TSconfig

 Bonn, GermanyFri, 07 Oct 2016 17:48:34 +0200 
Even after years working with #TYPO3 I am still impressed by the amazing and powerful configuration possibilities with #TypoScript. Just discovered a very elegant way how to configure the behaviour of the quick search fields in the backend when you want to link another content element.
On one page I want to change the behaviour of this quick search for a specific field in a content element and limit the results that can be searched.

To be concrete in calendar (extension: cal) event content elements (table: tx_cal_event) I want to limit the results that are available as locations for this event (field: location_id) which are queried from the table tt_address. I only want to get results that have set the field tx_cal_controller_islocation in the table tt_address. Of course you could edit the $TCA (Table Configuration Array) of tx_cal_event and change the definition of the suggest wizard globally, but there is a much more flexible and elegant way.

Just put this TSconfig in a PageTS or UserTS depending how you want this behaviour to be deployed, for example for a group of users only or a specific page only.
# Limit Location Suggest Wizard to cal-islocation addresses
TCEFORM.tx_cal_event.location_id.suggest.tt_address.searchCondition = tx_cal_controller_islocation=1



#^Wizards Configuration — Suggest wizard — TCA Reference 7.6 documentation
This renders an input field next to the selector of group-type fields (when internal_type is db) or of select-type fields (using foreign_table). After the user has typed at least 2 (minimumCharacters) characters in this field, a search will start and show a list of records matching the search word. The "suggest" wizard's properties can be configured directly in TCA or in page TSconfig (see TCEFORM properties).


#^TCEFORM ->TCEFORM_suggest — TSconfig Reference 8-dev documentation
Each level of the configuration overwrites the values of the level below it:
    "suggest.default" is overwritten by "suggest.[queryTable]".
    Both are overwritten by "[table name].[field].suggest.default" which itself is overwritten by "[table name].[field].suggest.[queryTable]"
suggest.default:
Configuration for all suggest wizards in all tables
suggest.[queryTable]:
Configuration for all suggest wizards from all tables listing records from table [queryTable]
[table name].[field].suggest.default
Configuration for the suggest wizard for field [field] in table [table name]
[table name].[field].suggest.[queryTable]
Configuration for the suggest wizard for field [field] in table [table name] listing records from [queryTable]
 TYPO3