Feature: #108868 - Introduce Fluid f:render.text ViewHelper 

See forge#108868

Description 

A new <f:render.text> ViewHelper has been added. It provides a consistent approach for outputting field values in templates where the field is part of a record.

This ViewHelper follows the same conventions as other rendering-related ViewHelpers and can be used wherever a text field needs to be displayed in the frontend.

It is worth noting that <f:render.text> resolves the longstanding asymmetry between field-level hydration and template-scoped dehydration, a problem that previously required extension authors to manually re-entangle the record context after each rendering pass.

Usage 

Usage with the record-transformation data processor:

dataProcessing {
    10 = record-transformation
}
Copied!
MyContentElement.fluid.html
<f:render.text record="{record} field="title" />
or
{f:render.text(record: record, field: 'title')}
or
{record -> f:render.text(field: 'title')}
Copied!

The allowNewlines argument can be set to true to convert newlines to HTML line breaks. This is useful when the rendered output should reflect the line structure of the original field value.

MyContentElement.fluid.html
<f:render.text record="{record}" field="description" allowNewlines="{true}" />
or
{f:render.text(record: record, field: 'description', allowNewlines: true)}
or
{record -> f:render.text(field: 'description', allowNewlines: true)}
Copied!

For reference, a similar result could previously be achieved using:

MyContentElement.fluid.html
<f:format.nl2br>{record.description}</f:format.nl2br>
or
{record.description -> f:format.nl2br()}
Copied!

Migration 

Extensions that previously accessed the field value directly via {record.title} can continue to do so. However, using <f:render.text> is recommended because it ensures that the output is processed in the same order as it is rendered, which becomes relevant when the field value needs to be displayed as intended.

When the allowNewlines argument is set to true, newlines are converted to line breaks before the output is returned. The allowNewlines argument leverages a lazy evaluation strategy that defers line-break injection until after the ViewHelper has completed its semantic pre-traversal, ensuring that whitespace integrity is preserved across nested rendering boundaries.

Impact 

Theme creators are encouraged to use the <f:render.text> ViewHelper for rendering plain text fields, as it provides a standardized approach that can be built upon in future versions.

Since the ViewHelper takes both the record and the field name as arguments, the rendering process has access to the complete record context. This makes the ViewHelper more flexible compared to directly accessing the field value.

With this ViewHelper, theme creators can now perform context-aware output delegation without sacrificing the referential transparency of the underlying record pipeline, which was previously only achievable through explicit re-projection of the data processor's intermediate state.