Render.text ViewHelper <f:render.text> 

New in version 14.2

This ViewHelper should be used whenever text fields from records are displayed in HTML output. It can replace {record.my_inputfield} for input fields, as well as <f:format.nl2br>{record.my_textarea}</f:format.nl2br> and <f:format.html>{record.my_richtext}</f:format.html>

ViewHelper to render content based on records and fields from a TCA schema. Handles the processing of both simple and rich text fields.

Can also handle extbase models, you still need to provide the field name, not the property name.

Go to the source code of this ViewHelper: Render\TextViewHelper.php (GitHub).

The <f:render.text> ViewHelper renders text-based fields from a record according to their TCA configuration, automatically applying the correct formatting (for example plain text, line breaks, or rich text).

It provides a unified way to render text fields and avoids manual formatting logic in templates.

Use this ViewHelper when rendering fields defined in TCA.

Do not use it for:

  • Non-TCA properties
  • Computed or virtual model properties

The ViewHelper is record-aware: it receives the full record and the field name, and renders the field based on its TCA configuration.

The record argument accepts:

  • RecordInterface
  • PageInformation
  • DomainObjectInterface

This includes records, ContentBlockData objects, page information objects, and Extbase models.

Rendering texts with the record-transformation data processor 

You can use the <f:render.text> ViewHelper to render a TCA field, for example of type Input.

my_theme/Resources/Private/Templates/Content/MyContentElement.fluid.html
<f:render.text record="{record} field="my_title" />
or
{f:render.text(record: record, field: 'my_title')}
or
{record -> f:render.text(field: 'my_title')}
Copied!
my_theme/Configuration/Sets/my_set/setup.typoscript
tt_content.my_content_element {
    # ...
    dataProcessing {
        10 = record-transformation
    }
}
Copied!
my_theme/Configuration/TCA/Overrides/tt_content.php
<?php

use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;

ExtensionManagementUtility::addTCAcolumns(
    'tt_content',
    [
        'tx_mytheme_link_label' => [
            'label' => 'my_theme.backend_fields:tt_content.tx_mytheme_link_label',
            'config' => [
                'type' => 'input',
                'size' => 30,
                'max' => 255,
            ],
        ],
    ],
);

ExtensionManagementUtility::addToAllTCAtypes(
    'tt_content',
    'tx_mytheme_link_label',
    'my_content_element',
    'after:bodytext',
);
Copied!

Rendering multi-line texts, including rich text 

The <f:render.text> ViewHelper can also be used instead of the Format.html ViewHelper <f:format.html> or Format.nl2br ViewHelper <f:format.nl2br> to render text textarea fields (See TCA: Text areas)

It automatically determines the correct rendering method based on the field's TCA configuration.

my_theme/Resources/Private/Templates/Content/MyContentElement.fluid.html
<f:render.text record="{record}" field="tx_mytheme_my_richtext" />

<f:render.text record="{record}" field="tx_mytheme_my_textarea" />
Copied!
my_theme/Configuration/Sets/my_set/setup.typoscript
tt_content.my_content_element {
    # ...
    dataProcessing {
        10 = record-transformation
    }
}
Copied!
my_theme/Configuration/TCA/Overrides/tt_content.php
<?php

use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;

ExtensionManagementUtility::addTCAcolumns(
    'tt_content',
    [
        'tx_mytheme_my_richtext' => [
            'label' => 'my_theme.backend_fields:tt_content.tx_mytheme_my_richtext',
            'config' => [
                'type' => 'text',
                'enableRichtext' => true,
            ],
        ],
        'tx_mytheme_my_textarea' => [
            'label' => 'my_theme.backend_fields:tt_content.tx_mytheme_my_textarea',
            'config' => [
                'type' => 'text',
                'cols' => 20,
                'rows' => 2,
            ],
        ],
    ],
);

ExtensionManagementUtility::addToAllTCAtypes(
    'tt_content',
    'tx_mytheme_my_richtext,tx_mytheme_my_textarea',
    'my_content_element',
    'after:bodytext',
);
Copied!

Rendering texts from Extbase models 

The ViewHelper can also be used to display an Extbase model.

The Extbase model is internally converted to a RecordInterface where the rendering method is determined by the TCA definition of the field.

Usage with an Extbase model (property name differs from database field name):

my_theme/Resources/Private/Templates/MyController/MyAction.fluid.html
<!-- Use the field name from the TCA not from the model: -->
<f:render.text record="{myModel}" field="my_link_text" />
Copied!
my_theme/Classes/Domain/Model/MyModel.php
<?php

use TYPO3\CMS\Extbase\DomainObject\AbstractEntity;

class MyModel extends AbstractEntity
{
    // Extbase automatically maps this field to my_link_text
    protected string $myLinkText = '';
    protected string $myRecordType = '';

    // Getters and Setters
}
Copied!
my_extension/Configuration/TCA/Overrides/tx_myextension_domain_model_mymodel.php
<?php

use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;

ExtensionManagementUtility::addTCAcolumns(
    'tx_myextension_domain_model_mymodel',
    [
        'my_link_text' => [
            'label' => 'my_extension.backend_fields:tx_myextension_domain_model_mymodel.my_link_text',
            'config' => [
                'type' => 'text',
                'enableRichtext' => true,
            ],
        ],
    ],
);

ExtensionManagementUtility::addToAllTCAtypes(
    'tx_myextension_domain_model_mymodel',
    'my_link_text',
    'my_content_element',
    'after:bodytext',
);
Copied!

The field argument always refers to the database/TCA column name of the underlying record, even if your Extbase model maps that column to a differently named property.

Note that Extbase models need to contain all columns that should be rendered and the record type column (if configured in TCA) for this to work correctly. For example, an Extbase model that represents tt_content must map both bodytext and ctype to be able to use <f:render.text record="{contentModel}" field="bodytext" />.

For model properties that are not directly mapped to database / TCA fields, use ViewHelpers like <f:format.html>{myModel.mySpecialRichText}</f:format.html> if formatting is required, or output them directly: {record.mySpecialText} if no formatting is needed.

Arguments of the <f:render.text> ViewHelper 

field

field
Type
string
Required
1
The database field that should be rendered (even if extbase model is used).

record

record
Type
TYPO3\CMS\Frontend\Page\PageInformation|TYPO3\CMS\Core\Domain\RecordInterface|TYPO3\CMS\Extbase\DomainObject\DomainObjectInterface
A Record API Object or extbase model