Building a TYPO3 extension in Extbase/Fluid
Using rich text on a textfield
Add RTE (Rich Text Editor) to textfield and display textfield as HTML in frontend
Option 1
Use the Extension Builder ››› set the respective properties to “Rich Text” instead of “Text”
Option 2 for TYPO3 8 LTS and later
Manually edit /typo3conf/ext/your_extension/Configuration/TCA/YourModelObject.php
just add 'enableRichtext' => true,
to array columns['your_property']['config']
'config' => array(
'eval' => 'trim',
'type' => 'text',
'enableRichtext' => true,
'eval' => 'trim',
),
),
Option 2 for TYPO3 6.2 and 7
Manually edit /typo3conf/ext/your_extension/Configuration/TCA/YourModelObject.php
- in array
'types'
changeyour_property
toyour_property;;;richtext::rte_transform[flag=rte_disabled|mode=ts_css]
-
in same file change array
'columns'
››› adddefaultExtras
tocolumns[your_property]
and change the arrayconfig
›››
'config' => array(
)
'type' => 'text',
'eval' => 'trim',
'wizards' => array(
'RTE' => array(
'icon' => 'wizard_rte2.gif',
'notNewRecords'=> 1,
'RTEonly' => 1,
'script' => 'wizard_rte.php',
'title' => 'LLL:EXT:cms/locallang_ttc.xlf:bodytext.W.RTE',
'type' => 'script'
)
)
),
'defaultExtras' => 'richtext[]:rte_transform[mode=ts_css]'
),
'defaultExtras' => 'richtext[]:rte_transform[mode=ts_css]'
Additionally you’ll have to wrap the field in the fluid template like <f:format.html>{object.property}</f:format.html>
otherwise all HTML tags entered by the RTE will be encoded with HTML entities and thus displayed as source code.