phpautocompletetypo3autosuggesttypo3-tca

TYPO3 suggest wizard, search in substring


I use the suggest wizard in TYPO3 backend.

The following code is in the tca:

'tx_db_colors' => array (
'exclude' => 0,
'label' => 'Farbe',
    'config' => array (
        "type" => "group",
        "allowed" => "tx_db_colors",
        "foreign_table" => "tx_db_colors",
        "internal_type" => "db",
        "size" => 1,
        "minitems" => 0,
        "maxitems" => 1,
        'items' => array(array('', ''),),
        'wizards' => array(
            'suggest' => array(
                'type' => 'suggest',
            ),
        ),
    )
),

Is there a solution, to get matched records in substring of the label, not from scratch?

Example:

The records label is named 'coffee black'

When I type 'co' into the search field, the record will be shown.

'blac' won't match to any record.

Is this possible to find this record, when I type in a substring? Else I have to extend the autocompletion. TYPO3 Core, yuk! :-)

Thank you in advance!


Solution

  • After hours, I found the solution. You have to write the tca like this:

    'tx_db_colors' => array (
        'exclude' => 0,
        'label' => 'Farbe',
        'config' => array (
            "type" => "group",
            "allowed" => "tx_db_colors",
            "foreign_table" => "tx_db_colors",
            "internal_type" => "db",
            "size" => 1,
            "minitems" => 0,
            "maxitems" => 1,
            'items' => array(array('', ''),),
            'wizards' => array(
                'suggest' => array(
                    'type' => 'suggest',
                    'default' => array(
                        'searchWholePhrase' => 1
                    ),
                ),
            ),
        )
    ),
    

    Just add

    'default' => array(
        'searchWholePhrase' => 1
    ),
    

    into the 'suggest' array.