suggestOptions

suggestOptions
Path

$GLOBALS['TCA'][$table]['columns'][$field]['config']

type

array

Scope

Display

InternalType

db

Optional, additional suggest options used if the suggest wizard is not hidden. The suggest wizard options can also be overriden on a page TSconfig level.

Suggestions can be configured differently for each table. Settings in "default" are applied to all tables. In the example below, there is a special setting for the "pages" table to search only standard pages.

'related_records' => [
   'label' => 'Related records',
   'config' => [
      'type' => 'group',
      'internal_type' => 'db',
      'allowed' => 'pages, tt_content',
      'suggestOptions' => [
         'default' => [
            'searchWholePhrase' => 1
         ],
         'pages' => [
            'searchCondition' => 'doktype = 1'
         ]
      ]
   ]
],
Copied!
additionalSearchFields (string)
Comma-separated list of fields the suggest wizard should also search in. By default the wizard looks only in the fields listed in the label and label_alt of TCA ctrl properties.
addWhere (string)

Allows to define an additional where clause for the searchquery. It supplies a marker for ###THIS_UID### which is useful to exclude the current record.

cssClass (string)
Add a CSS class to every list item of the result list.
maxItemsInResultList (integer)
Maximum number of results to display, default is 10.
maxPathTitleLength (integer)
Maximum number of characters to display when a path element is too long.
minimumCharacters (integer)
Minimum number of characters needed to start the search. Works only in "default" configuration array.
orderBy (string)
Allows to add an ORDER BY part to the search query.
pidList (list of values)

Limit the search to certain pages (and their sub pages). When pidList is empty all pages will be included in the search (as long as the be_user is allowed to see them).

Example

'storage_pid' => [
   'config' => [
      'suggestOptions' => [
         'default' => [
            'pidList' => '1,2,3,45',
         ],
      ],
   ],
],
Copied!
pidDepth (integer)

Expand pidList by this number of levels. Has an effect only if pidList has a value.

Example

'storage_pid' => [
   'config' => [
      'suggestOptions' => [
         'default' => [
            'pidList' => '6,7',
            'pidDepth' => 4
         ],
      ],
   ],
],
Copied!
receiverClass (string)
PHP class alternative receiver class, default is TYPO3\\CMS\\Backend\\Form\\Wizard\\SuggestWizardDefaultReceiver. Can be used to implement an own search strategy.
renderFunc (string)
User function to manipulate the displayed records in the results.
searchCondition (string)

Additional WHERE clause (not prepended with AND).

Example

'storage_pid' => [
   'config' => [
      'suggestOptions' => [
         // configures the suggest wizard for the field "storage_pid"
         // in table "pages" to search only for pages with doktype=1
         'pages' => [
            'searchCondition' => 'doktype=1',
         ],
      ],
   ],
],
Copied!
searchWholePhrase (boolean)

Whether to do a LIKE=%mystring% (searchWholePhrase = 1) or a LIKE=mystring% (to do a real find as you type), default is 0.

Example

'storage_pid' => [
   'config' => [
      'suggestOptions' => [
         'default' => [
            'searchWholePhrase' => 1,
         ],
      ],
   ],
],
Copied!

Examples

Only show pages with doktype=1 in the suggest options

EXT:styleguide/Configuration/TCA/tx_styleguide_elements_group.php
[
    'columns' => [
        'group_db_10' => [
            'exclude' => 1,
            'label' => 'group_db_10 allowed=pages size=1',
            'config' => [
                'type' => 'group',
                'allowed' => 'pages',
                'maxitems' => 1,
                'minitems' => 0,
                'size' => 1,
                'suggestOptions' => [
                    'default' => [
                        'additionalSearchFields' => 'nav_title, alias, url',
                        'addWhere' => 'AND pages.doktype = 1',
                    ],
                ],
            ],
        ],
    ],
]
Copied!