0

我不知道如何描述它......我正在尝试使用我自己的记录上的后端搜索来搜索某些值,例如名字、姓氏等,但寻址不同的表fe_users这种关系是存在的,也是正确的

例子:

后端搜索

当我搜索用户名、名字或姓氏时,我收到 0 个结果:

没有结果

那是我的 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
        ]
    ]
  ],
];

实施起来容易吗?我可能缺少配置吗?

4

1 回答 1

1

搜索不会解决关系,而只会考虑searchFields到。因此,您可以使用DataHandler的钩子并将相关用户的某些字段的值添加到表的只读字段中并使其可搜索。

于 2021-10-05T06:22:35.390 回答