ascawath
ascawath

Reputation: 59

TYPO3 CMS7 TCA - RTE and ValuePicker

I've tried to make my own distribution but still stuck at TCA script... I tried to make an own Content Element, that also worked. But if I want to display an Textarea as RichTextEditor or an Input Field as an ValuePicker, it won't work.

So this is my code in tt_content.php

$GLOBALS['TCA']['tt_content']['columns']['testText'] = array(
    'exclude' => 1,
    'label' => 'LLL:EXT:PRIVATE/Resources/Private/Language/locallang_tabs.xlf:tesText',
    'config' => array(
        'type' => 'text',
        'cols' => 40,
        'rows' => 6,
        'wizards' => array(
            '_PADDING' => 2,
            'RTE' => array(
                'notNewRecords' => 1,
                'RTEonly' => 1,
                'type' => 'script',
                'title' => 'Full Test',
                'module' => array(
                    'name' => 'wizard_rte'
                ),
                'icon' => 'wizard_rte2.gif'
            )
        ),
        'enableRichtext' => true,
        'defaultExtras' => 'richtext[]'
    )
);

At the Backend I can see only the normal Textarea and no RTE or even a ValuePicker. Even though I change the palette type to Bodytext as following, there is an Textarea.

$GLOBALS['TCA']['tt_content']['types']['PRIVATE_termin'] = array(
   'showitem' => '
         --palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xml:palette.general;general,
         --palette--;LLL:EXT:PRIVATE/Resources/Private/Language/locallang_tabs.xlf:general, header, bodytext, termin, termin2, platz, farbe
');

I defined the ValuePicker as following:

$GLOBALS['TCA']['tt_content']['columns']['farbe'] = array(
   'label' => 'LLL:EXT:PRIVATE/Resources/Private/Language/locallang_tabs.xlf:farbe',
   'config' => array(
        'type' => 'input',
        'size' => 20,
        'valuePicker' => array(
            'items' => array(
                ['#496D0C', '<font color="#496D0C">Neutral</font>'],
                ['#91AD33', '<font color="#91AD33">Gr&uuml;n</font>'],
                ['#F59B00', '<font color="#F59B00">Gelb</font>'],
                ['#CD1013', '<font color="#CD1013">Rot</font>']
            ),
        )
   )
);

I also tried to remove the HTML tags, but it still won't work.

I'm looking forward to hearing from you :)

MfG Ascawath

Upvotes: 0

Views: 596

Answers (3)

cweiske
cweiske

Reputation: 31147

As far as I see, valuePicker is not supported in TYPO3 7.6 but in TYPO3 v8 only.

It was introduced in january 2017; https://github.com/TYPO3/TYPO3.CMS/commit/84be5e616b5373ac7ba57edf2d3cd61251dc6f97

In TYPO3 7.6 you need a select wizard - https://docs.typo3.org/typo3cms/TCAReference/7.6/AdditionalFeatures/WizardsConfiguration/Index.html#select-wizards

Upvotes: 1

Pravin Vavadiya
Pravin Vavadiya

Reputation: 3207

For TYPO3 7 LTS. TCA configuration for RTE fields. like below.

'description' => array(
    'exclude' => 1,
    'label' => 'LLL:EXT:ext_list/Resources/Private/Language/locallang_db.xlf:tx_extlist_domain_model_extlist.description',
    'config' => array(
           'type' => 'text',
           'cols' => '30',
           'rows' => '3'
    ),
    'defaultExtras' => 'richtext[strong|emphasis]:rte_transform[ts]'
),

Upvotes: 0

bschauer
bschauer

Reputation: 1010

You could enable the RTE with 'columnsOverrides'

$GLOBALS['TCA']['tt_content']['types']['startpilot_textimage'],
    [
        'showitem' => $showitem_default_01 . '
        header;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:header_formlabel,
        header_layout;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:header_layout_formlabel,
        imageposition,
        image,
        bodytext,
        ' . $showitem_default_02,
        'columnsOverrides' => [
            'bodytext' => ['defaultExtras' => 'richtext:rte_transform[mode=ts_css]'],
            'image' => array(
                'config' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig(
                    'image',
                    array(
                        'collapseAll' => 1,
                        'maxitems' => 1,
                    )
                ),
            ),
        ]
    ]

Upvotes: 1

Related Questions