Bug #15720
closedFields of type 'select' with maxitems>1 and itemsProcFunc set work only, if items is set also
0%
Description
I consider the following fact confusing, especially, because it's not documented (or I didn't find it in documentation).
The following in TCA works even if nonIDvalues are set by &tx_hgwstaff_processSortings->main. If the items-Part is left out, it won't.
-----------------
"fieldname" => Array (
"config" => Array (
"type" => "select",
'items' => Array (
Array('', 0),
),
"allowNonIdValues" => 1,
"itemsProcFunc" =>"&tx_hgwstaff_processSortings->main",
"maxitems" => 5,
-----------------
It doesn't work if setup is:
-----------------
"fieldname" => Array (
"config" => Array (
"type" => "select",
//Here is no items-Initialization necessary, because it's done by itemsProcFunc
"allowNonIdValues" => 1,
"itemsProcFunc" =>"&tx_hgwstaff_processSortings->main",
"maxitems" => 5,
-----------------
The reason seams to be in class.t3lib_transferdata.php:
[...]
function renderRecord_selectProc($data,$fieldConfig,$TSconfig,$table,$row,$field) {
global $TCA;
// Initialize:
$elements = t3lib_div::trimExplode(',',$data,1); // Current data set.
$dataAcc=array(); // New data set, ready for interface (list of values, rawurlencoded)
// For list selectors (multi-value):
if (intval($fieldConfig['config']['maxitems'])>1) {
// Add regular elements:
if (is_array($fieldConfig['config']['items'])) { //Process of Items is only called, if the array is initialized.
$fieldConfig['config']['items'] = $this->procesItemArray($fieldConfig['config']['items'], $fi foreach($fieldConfig['config']['items'] as $pvpv) {
foreach($elements as $eKey => $value) {
if (!strcmp($value,$pvpv[1])) {
$dataAcc[$eKey]=rawurlencode($pvpv[1]).'|'.rawurlencode($pvpv[0]);
}
}
}
}
[...]
(issue imported from #M2694)