Issue Bug Closed

#18411Backend search (list module) is restricted to hardcoded TCA field types

Rainer Kuhn 03/10/08, 14:20 updated 09/09/13, 08:52

Description

The backend search in the backend’s list module is restricted to text and input fields (input fields only if not eval’ed to ‘date|time|int’), read-only fields of type ‘none’ are not consider by the search. Setting a field type to ‘none’ in TCA to make a text field read-only in the backend form should not prevent fields from being searched.

This restriction is hardcoded in method recordList::makeSearchString() of of class.db_list.inc (line 497 ff.):

[…]
// Initialize field array:
$sfields=array();
$sfields[]=‘uid’; // Adding “uid” by default.

// Traverse the configured columns and add all columns that can be searched:
foreach($TCA[$table][‘columns’] as $fieldName => $info) {
if ($info[‘config’][‘type’]==‘text’ || ($info[‘config’][‘type’]==‘input’ && !ereg(‘date|time|int’,$info[‘config’][‘eval’]))) {
$sfields[]=$fieldName;
}
}
[…]

There are several possibilities to change this behaviour (respective to allow individual search fields for the developer):
1) Add ‘$info[‘config’][‘type’]==‘none’ to the above mentioned condition for retrieving the search fields – but this is still not very flexible
2) Add a hook to manipulate $sfields in recordList::makeSearchString()
3) Extending the TCA in a backwards compatible way, e.g. with a config ‘searchable’ for non-text/non-input fields?

Adding at hook as a first step could add a ot of flexibilty for developers.

Best regards,
Rainer

(issue imported from #M7807)

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.