Review main Merged

95422[BUGFIX] Support `f:render.text` for backend rich text

Matthias Vogel CR +2 V +2 Normal +84 −9 updated 08/27/26, 14:55

Commit message

The `f:render.text` ViewHelper uses the TCA field configuration to
render record values. Rich-text fields have so far been passed to
`f:format.html`, even when the template is rendered in a backend
request. Since that ViewHelper deliberately rejects backend usage,
rendering such fields fails.

The restriction exists because `f:format.html` runs
`lib.parseFunc_RTE`. This is frontend TypoScript whose result can
depend on the current page, site, language, rootline and other
frontend request state. Supplying that state in the backend would
require emulating a frontend request and could produce unpredictable
results.

Preserve `f:format.html` for frontend requests. For backend requests,
pass the value through `f:sanitize.html` and then
`f:transform.html`. Sanitization makes the stored HTML safe to
display, while transformation resolves TYPO3 URI references such as
`t3://page?uid=1`.

This backend pipeline intentionally does not reproduce every operation
that may be configured in `lib.parseFunc_RTE`. It provides a safe and
predictable representation of RTE content without introducing a
dependency on unavailable frontend context.

Add functional coverage for sanitizing unsafe markup and transforming
internal page links in backend requests.

Review

  • Code review CR +2 Done
    • Garvin Hicking +2
    • Simon Praetorius +1
    • Nikita Hovratov +1
  • Verified V +2 Done
    • Garvin Hicking +2
    • Simon Praetorius +1
    • Nikita Hovratov +1
    • core-ci +1 CI

Issues 1

Files 2

Review log 1921

  1. Matthias Vogel uploaded patch set 1 08/26/26, 11:13

  2. core-ci voted on patch set 1 V +1 08/26/26, 11:20 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/107133

  3. Matthias Vogel marked it ready for review 08/26/26, 11:20

  4. Oli Bartsch commented on patch set 1 08/26/26, 11:38

    TextViewHelper.php:207

    Just from reading, why do we switch from HtmlViewHelper to this one?
  5. Matthias Vogel commented on patch set 1 08/26/26, 11:40

    TextViewHelper.php:207 Reply

    It is still 'Format\HtmlViewHelper'; it's just a class alias in this file to distinguish between the 3 HtmlViewHelpers.
  6. Simon Praetorius commented on patch set 1 CR +1 V +1 08/26/26, 11:41

    tested in a v14 project
  7. Matthias Vogel commented on patch set 1 08/26/26, 11:52

    TextViewHelper.php:207 Reply

    Done
  8. Garvin Hicking commented on patch set 1 08/26/26, 22:06

    TextViewHelper.php:204

    Did you by chance measure performance impact if this is run many times for many fields? Maybe using a runtime cache for the result of this could be useful, if it's impactful?
  9. Matthias Vogel commented on patch set 1 08/27/26, 07:22

    TextViewHelper.php:204 Reply

    It is the same code as it is inside the Format\HtmlViewHelper. I measured that condition part: ~0.0025 ms per invocation. so we can run that part 400k times per second :) I think we do not have a Problem here.
  10. Garvin Hicking commented on patch set 1 CR +1 08/27/26, 07:49

    TextViewHelper.php:204 Reply

    Acknowledged
  11. Nikita Hovratov commented on patch set 1 08/27/26, 08:53

    TextViewHelper.php:212

    I think we can get rid of this else with early return
  12. Nikita Hovratov voted on patch set 1 V +1 08/27/26, 09:05

  13. Nikita Hovratov commented on patch set 1 08/27/26, 09:06

    TextViewHelper.php:212 Reply

    (not blocking)
  14. Nikita Hovratov commented on patch set 1 08/27/26, 09:06

    TextViewHelper.php:212 Reply

    Done
  15. Matthias Vogel uploaded patch set 2 CR +1 V +1 08/27/26, 09:45

  16. Garvin Hicking voted on patch set 2 CR +1 08/27/26, 09:49

  17. Nikita Hovratov voted on patch set 2 CR +1 V +1 08/27/26, 09:49

  18. Simon Praetorius voted on patch set 2 CR +1 V +1 08/27/26, 10:01

  19. core-ci voted on patch set 2 V +1 08/27/26, 10:05 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/107245

  20. Garvin Hicking voted on patch set 2 CR +2 V +2 08/27/26, 14:55

  21. Garvin Hicking merged patch set 3 08/27/26, 14:55