[TYPO3-dev] Modifying TypoScript code to allow access to flexform data

Felix Buenemann Felix.Buenemann at gmx.de
Mon Jul 28 13:17:21 CEST 2008


Hello Martin,

Martin Kutschker schrieb:
> Felix Buenemann schrieb:
>> Hello,
>>
>> I noticed, that there is basically no way to access flexform data from
>> within typoscript, so I'd like to extend this functionality.
>> someItem = COA
>> someItem {
>>   10 = TEXT
>>   10.field = tx_templavoila_flex|some_flexform_field
>>   10.wrap = <span>|</span>
>>   20 = TEXT
>>   20.field = tx_templavoila_flex|some_other_flexform_field
>> }
 >>
>> In which class of t3lib can I find the corresponding code that handles
>> .field .data etc.?
>
> tslib_content.php but I would try to do this with user functions instead
>   of XCLASSing.
OK, I have found the specific code in class.tslib_content:getFieldVal

Now I wonder what is the best place to implement this code.

One way would be to extend the tslib_cObj class, this would have the pro 
of making this functionality globally available and very simple to use.
But I don't know how I must proceed to have this class included 
everywhere instead of the original class -- how I can overrride class 
tslib_cObj globally. You can probably give me a hint as how to achieve that.

Another way as you suggested would be a userFunc, eg. something like:

someItem = COA
someItem {
   10 = TEXT
   10.field = tx_templavoila_flex
   10.preUserFunc = user_ffcObj->parseFFfields
   10.preUserFunc.fields = some_ff_field
}

In this case the flexform xml data would be passed inside $content to 
the user func. The user func could then do a 
pi_getFFvalue(xml2array($content), 'some_ff_field') and return the 
result as new content.

However this seems way more dirty and inflexible than extending the cObj 
class to allow flexform fields to be specified everywhere, where native 
database fields are allowed.


>
> Note that a recenet discussion concerning FlexForms and BE configuration
> revealed that a FF can be quite complex, so a simple syntax may only
> work for your specific needs, but not all FFs.
Could you provide a link to that discussion?

> But better to have access to fields in a simple case then none.
agree ;-)

> Masi

Best Regards,
    Felix Buenemann





More information about the TYPO3-dev mailing list