Is there a possibility to search for type 'group' records in own plugin records?

68 views Asked by At

I am not sure how to describe it.... I am trying to search for certain values such as first name, last name, etc. using backend search on my own records but addressing a different table fe_users. The relation is present and is also correct.

Example:

backend search

When I search for the username, first_name or last_name I receive 0 results:

no results

That´s my TCA:

return [
'ctrl' => [
    'title' => 'My custom Plugin',
    'label' => 'user',
    'tstamp' => 'tstamp',
    'crdate' => 'crdate',
    'cruser_id' => 'cruser_id',
    'versioningWS' => false,
    'languageField' => 'sys_language_uid',
    'transOrigPointerField' => 'l10n_parent',
    'transOrigDiffSourceField' => 'l10n_diffsource',
    'delete' => 'deleted',
    'enablecolumns' => [
        'disabled' => 'hidden',
        'starttime' => 'starttime',
        'endtime' => 'endtime',
    ],
    'searchFields' => 'user, customId',
    'iconfile' => '' // todo
],
'interface' => [
    'showRecordFieldList' => 'sys_language_uid, l10n_parent, l10n_diffsource, user, customId',
],
'types' => [
    '1' => [
        'showitem' => 'sys_language_uid, l10n_parent, l10n_diffsource, user, customId'
    ],
],
'columns' => [
    'user' => [
        'label' => 'FE-User',
        'config' => [
            'type' => 'select',
            'renderType' => 'selectSingle',
            'foreign_table' => 'fe_users',
            'readOnly' => true
        ],
    ],
    'customId' => [
        'label' => 'My custom plugin',
        'config' => [
            'type' => 'group',
            'internal_type' => 'db',
            'allowed' => 'tt_content',
            'readOnly' => true,
            'size' => 1
        ]
    ]
  ],
];

Is it easy to implement? Am I missing a configuration perhaps?

1

There are 1 answers

1
Georg Ringer On BEST ANSWER

The search does not resolve relations but only takes the searchFields into account. So you could use a hook of the DataHandler and add values of some fields of the related user to a readonly field of your table and make that searchable.