Gernott / mask

TYPO3 Extension Mask
https://www.facebook.com/typo3mask
GNU General Public License v2.0
130 stars 86 forks source link

Allow bodytext field for textareas (use existing field) #408

Closed akiessling closed 2 years ago

akiessling commented 3 years ago

When i add an RTE field, i get the selector to use the existing bodytext field. When adding a textarea, i don't get that option, but can select other text fields from tt_content. Shouldn't bodytext also show up here?

mask version 7.0.0 TYPO3 version 10.4.16

nhovratov commented 3 years ago

Hi @akiessling, you can only select existing fields that match with the current field type. TYPO3 bodytext is the only core RTE field. So everything is correct :)

akiessling commented 3 years ago

Hi @nhovratov,

well, it only becomes an RTE with columnsOverrides.

The default config is like this

        'bodytext' => [
            'l10n_mode' => 'prefixLangTitle',
            'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.text',
            'config' => [
                'type' => 'text',
                'cols' => 80,
                'rows' => 15,
                'softref' => 'typolink_tag,email[subst],url',
                'search' => [
                    'andWhere' => '{#CType}=\'text\' OR {#CType}=\'textpic\' OR {#CType}=\'textmedia\''
                ]
            ]
        ],

The field is used in different CTypes, for RTE

            'columnsOverrides' => [
                'bodytext' => [
                    'config' => [
                        'enableRichtext' => true,
                    ]
                ]
            ]

for tables

            'columnsOverrides' => [
                'bodytext' => [
                    'config' => [
                        'renderType' => 'textTable',
                        'wrap' => 'off',
                    ],
                ],
            ],

So IMHO it should show as a target for a textarea, so you won't loose data when switching between similar CTypes

nhovratov commented 3 years ago

@akiessling Yes, you are absolutely right regarding columnsOverrides. But it's kinda awkward to have a field, which can be both text and RTE. Mask is adding this line for bodytext fields: $GLOBALS['TCA']['tt_content']['types'][$cTypeKey]['columnsOverrides']['bodytext']['config']['enableRichtext'] = 1;. This means bodytext will always be a RTE field. We can't remove this or else other installations will break.

nhovratov commented 3 years ago

I can put this to the feature list though. It is certainly possible, but not with backwards compatibility.

akiessling commented 3 years ago

I'd consider the hardcoded bodytext setting as a bug itself, since it is also set, even if the bodytext field is not in use.

nhovratov commented 3 years ago

Okay, this is another story. Can be cleaned up together with the feature as its not hurting anyone.

nhovratov commented 2 years ago

Fixed both, the bodytext field being now selectable as text and richtext, and the hard coded enableRichtext=1 for all elements, even without bodytext field now checks, if the bodytext field is used. Fully backwards compatible!

akiessling commented 2 years ago

Awesome :) Thank you for taking care!