[TYPO3-dev] getting data out of flexForm structure

Dr. Ronald P. Steiner Ronald.Steiner at googlemail.com
Sun Feb 24 20:58:10 CET 2008


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

greetings

Ron

Dr. Ronald P. Steiner schrieb:
> Hi List,
> 
> I'm working on an extension.
> - it basically gets the data fields of a certain content element and 
> reads them into an array. If the content element contains flex form this 
> array will contain fields like:
> 
> $array['pi_flexform'] = '<?xml version="1.0" encoding="utf-8" 
> standalone="yes" ?> <T3FlexForms> ....';
> 
> I now want to transform this information into an array. Any one got an 
> idea?
> 
> Just to mention, the following will not work:
> #####
> $this->pi_initPIflexForm();
> $conf = array();
> $piFlexForm = $this->cObj->data['pi_flexform'];
> foreach ( $piFlexForm['data'] as $sheet => $data )
>    foreach ( $data as $lang => $value )
>        foreach ( $value as $key => $val )
>           $conf[$key] = $this->pi_getFFvalue($piFlexForm, $key, $sheet);
> #####
> cause $this->pi_initPIflexForm() writes the flex-form data of the 
> current plugin into $this->cObj->data['pi_flexform'];
> 
> Hope someone has a hint.
> 
> greetings
> 
> Ron




More information about the TYPO3-dev mailing list