[TYPO3-dev] getting data out of flexForm structure

Daniel Pötzinger operation-lan at gmx.de
Mon Feb 25 00:53:55 CET 2008


Dr. Ronald P. Steiner schrieb:
> Hi List,
> 
> ... and here comes the answer, after looking how pi_initPIflexForm() 
> does it's job I finally figured out:
> 
> $piFlexForm = t3lib_div::xml2array($flexForm);
> $conf = array();
>   foreach ( $piFlexForm['data'] as $sheet => $data )
>      foreach ( $data as $lang => $value )
>         foreach ( $value as $key => $val )
>           $conf[$key] = $this->pi_getFFvalue($piFlexForm, $key, $sheet);
> 
> 
> basically instead of:
> $this->pi_initPIflexForm();
> $piFlexForm = $this->cObj->data['pi_flexform'];
> 
> 
> $piFlexForm = t3lib_div::xml2array($flexForm);

Its ok to use xml2array if you want to transform the xml into an array. 
Flexforms are designed to work with this transformation. However you 
need to code the logic to get the relevant fields depending on the 
languagesetting and nesting in the DS.

However there is a class like t3lib_flexformtools, which you can/should 
use for accessing data in the XML with a help of a callbackfunction.
(example usage in l10nmgr)

However a clean class for getting fields of a FCE (based on the 
languagesettings etc) is still missing in the templavoila extension or 
the core imho.




More information about the TYPO3-dev mailing list