【发布时间】:2020-03-02 08:48:14
【问题描述】:
我在typo3中有一个扩展名。我想使用 itemsProcFunc 进行单选按钮选择:
<radField>
<label>Radiobuttons</label>
<config>
<type>radio</type>
<itemsProcFunc>CM\Parser\UserFunc\FlexFormUserFunc->getNames</itemsProcFunc>
</config>
</radField>
很遗憾,我收到以下错误消息:
Item itemsProcFunc of field radField of TCA table tt_content is no array as exepcted
我也用选择框试过了:
<dynField>
<TCEforms>
<label>dynamic content</label>
<config>
<type>select</type>
<renderType>selectSingle</renderType>
<itemsProcFunc>CM\Parser\UserFunc\FlexFormUserFunc->getNames</itemsProcFunc>
</config>
</TCEforms>
</dynField>
使用选择框可以正常工作,但我得到了第一个条目 [无效值],我无法从下拉列表中删除该条目。但是,如果我使用
<renderType>selectCheckBox</renderType>
相反,我没有得到任何无效值,但我可以选择多个我不想选择的选项。
它后面的php文件是这样的:
class FlexFormUserFunc {
function getNames($config) {
$fileList = array();
$i=0;
$pathParts = "";
foreach(glob(__DIR__ . "/formatClasses/*.php") as $fileName) {
$pathParts = pathinfo($fileName);
$fileList[$i] = array( 0 => $pathParts['filename'], 1 => $pathParts['basename'] );
$i++;
}
$config['items'] = array_merge($config['items'],$fileList);
return $config;
}
}
感谢您的帮助。
【问题讨论】: