Feature #19235
closedUnused function t3lib_TCEforms::getSingleHiddenField() could be rewritten for proper usage
0%
Description
The function t3lib_TCEforms::getSingleHiddenField() seems to be unsused in the source code (like noticed yet in the comments).
While trying to build an "empty" structure in my flex:
[CODE]
<separator>
<type>array</type>
<tx_templavoila>
<title>LLL:EXT:edf_renderlets/tinyMCE/lang.xml:button.separator</title>
</tx_templavoila>
<el>
<icon>
<TCEforms>
<exclude>0</exclude>
<label></label>
<config>
<type>user</type>
<userFunc>tx_edfrdt_flex->getButtonIcon_Separator</userFunc>
</config>
</TCEforms>
</icon>
</el>
</separator>
[/CODE]
It appeared that as there were no input, my tag wasn't kept in flex so I decided to build an hidden field. However, this old function doesn't do it the correct way, I mean, like hidden fields are built in other functions :
[CODE] /**in getSingleHiddenField*/
$itemName=$this->prependFormFieldNames.'['.$table.']['.$uid.']['.$field.']';
$item.='<input type="hidden" name="'.$itemName.'" value="'.htmlspecialchars($itemValue).'" />';
[/CODE]
[CODE]/** Elsewhere*/
$item.='<input type="hidden" name="'.htmlspecialchars($PA['itemFormElName']).'" value="" />';
[/CODE]
Could be patched somehow like that:
[CODE]
function getSingleHiddenField($table,$field,$row,&$PA) {
global $TCA;
$out='';
t3lib_div::loadTCA($table);
if ($TCA[$table]['columns'][$field]) {
$itemValue=$row[$field];
$item.='<input type="hidden" name="'.htmlspecialchars($PA['itemFormElName']).'" value="'.htmlspecialchars($itemValue).'" />';
$out = $item;
}
return $out;
}
[/CODE]
(issue imported from #M9199)