Issue Feature Closed

#19235Unused function t3lib_TCEforms::getSingleHiddenField() could be rewritten for proper usage

Cyrille 08/20/08, 11:38 updated 09/09/13, 09:46

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><br> <type>array</type><br> <tx_templavoila><br> <title>LLL:EXT:edf_renderlets/tinyMCE/lang.xml:button.separator</title><br> </tx_templavoila><br> <el><br> <icon><br> <tceforms><br> <exclude>0</exclude><br> <label></label><br> <config><br> <type>user</type><br> <userfunc>tx_edfrdt_flex-&gt;getButtonIcon_Separator</userfunc><br> </config><br> </tceforms><br> </icon><br> </el><br> </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]

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)

Reviews 0

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