[TYPO3-english] Flexform in custom content element

Fabian fabianfabian at gmail.com
Wed Aug 18 20:39:23 CEST 2010


Thanks!

On 18-8-2010 20:17, Jigal van Hemert wrote:
> Hi,
>
> On 18-8-2010 17:11, Fabian wrote:
>> I've created my own content element and I'm using flexforms to make use
>> of some custom fields. How can I make the TYPO3 backend show some of the
>> custom fields?
>
> You can find a simple example in tt_news:
>
> In ext_localconf.php you'll find the line:
>
> $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/layout/class.tx_cms_layout.php']['list_type_Info']['9']['tt_news']
> =
> 'EXT:tt_news/lib/class.tx_ttnews_cms_layout.php:tx_ttnews_cms_layout->getExtensionSummary';
>
>
> This tells TYPO3 to ask that hook function to supply the information.
> The function is defined as:
>
> function getExtensionSummary($params, &$pObj) {
> if ($params['row']['list_type'] == 9) {
> $data = t3lib_div::xml2array($params['row']['pi_flexform']);
> if (is_array($data) &&
> $data['data']['sDEF']['lDEF']['what_to_display']['vDEF']) {
> $result =
> sprintf($GLOBALS['LANG']->sL('LLL:EXT:tt_news/locallang.xml:cms_layout.mode'),
>
>
> $data['data']['sDEF']['lDEF']['what_to_display']['vDEF']);
> }
> if (!$result) {
> $result =
> $GLOBALS['LANG']->sL('LLL:EXT:tt_news/locallang.xml:cms_layout.not_configured');
>
> }
> }
> return $result;
> }
>
> tt_news is one of the "old" extensions, so it has a numerical list_type
> (in this case '9'). The code in tt_news processes the flexform (just
> like you wanted) and displays for example:
> Displaying: SINGLE
> using a language string and data from the flexform.
>
> HTH
>



More information about the TYPO3-english mailing list