[TYPO3-english] temsProcFunc and selected items

Siva Prasad sivaprasad.s at pitsolutions.com
Mon Mar 7 17:05:55 CET 2016


I'm writing an extension which is configured via FlexForms.  One element of the FlexForm is of type 'select', with  maxitems > 1. I use itemsProcFunc to call an external class  method modifying the 'items' array.

This works fine so far, but when I try to save the plugin  options in BE, the entries under 'Selected:' vanish.  However, the selected values are stored correctly. See below for my flexform configuration . 

 <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;
}

When a printed flexfrom , I got 2 xml records in which one has comma seperated values stored inside the xml while the other has empty values . Can some one help me with this ?


More information about the TYPO3-english mailing list