itemsProcFunc和TYPO3 6.2中的选定项目
我正在编写一个通过FlexForms配置的扩展。FlexForm的一个元素类型为“select”,maxitems>1。我使用itemsProcFunc调用修改“items”数组的外部类方法 到目前为止,这还不错,但当我尝试在BE中保存插件选项时,“Selected:”下的条目消失了。但是,选定的值被正确存储。有关我的flexform配置,请参见下文itemsProcFunc和TYPO3 6.2中的选定项目,typo3,typo3-6.2.x,Typo3,Typo3 6.2.x,我正在编写一个通过FlexForms配置的扩展。FlexForm的一个元素类型为“select”,maxitems>1。我使用itemsProcFunc调用修改“items”数组的外部类方法 到目前为止,这还不错,但当我尝试在BE中保存插件选项时,“Selected:”下的条目消失了。但是,选定的值被正确存储。有关我的flexform配置,请参见下文 <settings.flexuserList> <TCEforms>
<settings.flexuserList>
<TCEforms>
<label>Sektionen</label>
<config>
<type>select</type>
<itemsProcFunc>tx_hevpersons_sections->dogetSectionInfo1</itemsProcFunc>
<maxitems>10000</maxitems>
<size>10</size>
</config>
</TCEforms>
</settings.flexuserList>
public function dogetSectionInfo1($params, $conf)
{
print_r($params['row']['pi_flexform']);
$flexform = \TYPO3\CMS\Core\Utility\GeneralUtility::xml2array($params['row']['pi_flexform']);
$grp = $flexform['data']['sDEF']['lDEF']['settings.flexroleList']['vDEF'];
$flexcantonval = $flexform['data']['sDEF']['lDEF']['settings.flexcanton']['vDEF'];
$flexsectionList = $flexform['data']['sDEF']['lDEF']['settings.flexsectionList']['vDEF'];
$flexuserList = $flexform['data']['sDEF']['lDEF']['settings.flexuserList']['vDEF'];
f( strstr( $grp , "|" ) ){
$string = explode(",",$grp);
foreach ($string as $key => $value) {
$array = explode('|',$value);
$nearay[$key] = $array[0];
}
}
if( count($nearay) ){
foreach ($nearay as $key => $value) {
$usergroupFind[$key] = 'FIND_IN_SET("'.$value.'",usergroup)';
}
$string = ' AND '.implode(' OR ', $usergroupFind) . ' ';
}
if( !empty($string) ){
$GLOBALS['TYPO3_DB']->store_lastBuiltQuery = 1;
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery("uid, name ", 'fe_users', 'deleted=0 AND disable=0 '.$string );
while($entry = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res))
{
$params['items'][count($params['items'])] = array(trim($entry['name'] ), $entry['uid']);
}
$GLOBALS['TYPO3_DB']->sql_free_result($res);
}
return $params;
}
塞克提奥尼
选择
tx_hevpersons_sections->dogetSectionInfo1
10000
10
公共函数dogetSectionInfo1($params,$conf)
{
打印($params['row']['pi_flexform']);
$flexform=\TYPO3\CMS\Core\Utility\GeneralUtility::xml2array($params['row']['pi_flexform']);
$grp=$flexform['data']['sDEF']['lDEF']['settings.flexroleList']['vDEF'];
$flexcantonval=$flexform['data']['sDEF']['lDEF']['settings.flexcanton']['vDEF'];
$flexsectionList=$flexform['data']['sDEF']['lDEF']['settings.flexsectionList']['vDEF'];
$flexuserList=$flexform['data']['sDEF']['lDEF']['settings.flexuserList']['vDEF'];
f(strstr($grp,“|”)){
$string=explode(“,”,$grp);
foreach($key=>$value的字符串){
$array=explode(“|”,$value);
$nearay[$key]=$array[0];
}
}
如果(计算($nearay)){
foreach($nearay作为$key=>$value){
$usergroupFind[$key]=“在_集合中查找_”(“.$value.”,usergroup)”;
}
$string='AND'。内爆('OR',$usergroupFind)。“”;
}
如果(!空($string)){
$GLOBALS['TYPO3\u DB']->store\u lastBuiltQuery=1;
$res=$GLOBALS['TYPO3\u DB']->exec\u SELECTquery(“uid,name”,“fe\u users”,“deleted=0,disable=0”。$string);
while($entry=$GLOBALS['TYPO3\u DB']->sql\u fetch\u assoc($res))
{
$params['items'][count($params['items'])]=array(trim($entry['name']),$entry['uid']);
}
$GLOBALS['TYPO3\u DB']->sql\u free\u结果($res);
}
返回$params;
}
当打印flexfrom时,我得到了2条xml记录,其中一条xml中存储有逗号分隔的值,而另一条xml中存储有空值。有人能帮我吗?我想你应该返回config而不是params 我的一个工作示例可能是您的帮助:
类型3 v7.6.2
-FlexForm设置
<settings.eventID>
<TCEforms>
<label>Available Event</label>
<config>
<type>select</type>
<size>1</size>
<minitems>0</minitems>
<maxitems>1</maxitems>
<itemsProcFunc>VENDOR\EXT\Controller\ControllerName->flexFormsEventsListItems</itemsProcFunc>
<items type="array"></items>
</config>
</TCEforms>
</settings.eventID>
我认为您应该返回config而不是params 我的一个工作示例可能是您的帮助:
类型3 v7.6.2
-FlexForm设置
<settings.eventID>
<TCEforms>
<label>Available Event</label>
<config>
<type>select</type>
<size>1</size>
<minitems>0</minitems>
<maxitems>1</maxitems>
<itemsProcFunc>VENDOR\EXT\Controller\ControllerName->flexFormsEventsListItems</itemsProcFunc>
<items type="array"></items>
</config>
</TCEforms>
</settings.eventID>
我试图从前面的两个flexform字段中获得结果,并在此基础上准备where条件。我也尝试过返回$conf。但对我来说效果不好。不管怎样,我都设法用另一种方法来解决这个问题。谢谢你抽出时间来检查这个!!我试图从前面的两个flexform字段中获得结果,并在此基础上准备where条件。我也尝试过返回$conf。但对我来说效果不好。不管怎样,我都设法用另一种方法来解决这个问题。谢谢你抽出时间来检查这个!!