Review main Merged

90024[FEATURE] Introduce HeaderData and FooterData ViewHelpers

Torben Hansen CR +2 V +2 Hard +266 −1 updated 08/29/25, 06:22

Commit message

Two new Fluid ViewHelpers have been added to simplify
the injection of raw HTML content into the `<head>`
or before the closing `</body>` tag of a page.

The ViewHelpers are:

* `<f:page.headerData>` - adds content to the page `<head>`
* `<f:page.footerData>` - adds content before </body>

The ViewHelpers internally make use of the PageRenderer
API and allow integrators to embed raw HTML such as
`<link>` or `<script>` elements directly in Fluid
templates.

These ViewHelpers should be used in situations where
`<f:asset.css>` or `<f:asset.script>` are insufficient
due to missing support for certain HTML attributes or
custom output needs.

This is a pre-patch for #107057.

Review

  • Code review CR +2 Done
    • Simon Praetorius +2
    • Oliver Klee +1
  • Verified V +2 Done
    • Simon Praetorius +2
    • Oliver Klee +1
    • core-ci +1 CI

Issues 1

Files 6

Review log 2027

Show 12 earlier messages
  1. Torben Hansen uploaded patch set 1 07/08/25, 13:07

  2. core-ci voted on patch set 1 V +1 07/08/25, 13:15 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/81491

  1. Benni Mack commented on patch set 1 07/08/25, 14:40

    Let's call it - page.headerData - page.footerData I also love to have - page.meta - page.title
  2. Benni Mack commented on patch set 1 07/08/25, 14:41

    Should we include - "priority" - "identifier" similar to existing asset ViewHelpers?
  3. Torben Hansen uploaded patch set 2 V +1 07/09/25, 06:11

  4. Torben Hansen commented on patch set 2 07/09/25, 06:13

    Reply

    The asset ViewHelper uses the asset collector, which is able to handle `priority` and `identifier`. The new ViewHelpers in this patch use plain `PageRenderer` functionality to add header- and footerData and just adds the viewHelpers content as is. AFAIK, `PageRenderer` has no functionality to control added header- or footerdata.

    Reply

    I renamed both ViewHelpers and added the suggested new ViewHelpers to my list.
  5. core-ci voted on patch set 2 V +1 07/09/25, 06:19 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/81515

  6. Torben Hansen commented on patch set 2 07/10/25, 17:33

    @benni@typo3.org We could also add a single a `<f:pageRenderer>` ViewHelper instead (we already have `<f:be.pageRenderer>` with mostly BE functionality for modules). The new `<f:pageRenderer>` viewHelper could provide some limited functionality of `PageRenderer` and have arguments like `addHeaderData`, `addFooterData` and `setPageTitle`. So basically one viewHelper for multiple purposes regarding the current oage rendering. What do you think?
  7. Torben Hansen commented on patch set 2 07/13/25, 10:17

    Reply

    I thought some time about the single viewHelper suggestion I made and came to the conclusion, that single viewHelpers fit better. Since `headerData` and `footerData` may include inline JS or multiple tags, it is better to use dedicated viewHelpers for both cases, so it is possible to use `renderChildren()`.
  8. Torben Hansen uploaded patch set 3 V +1 07/13/25, 10:44

  9. core-ci voted on patch set 3 V +1 07/13/25, 10:52 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/81656

  10. Torben Hansen uploaded patch set 4 V +1 07/20/25, 11:55

  11. core-ci voted on patch set 4 V +1 07/20/25, 12:02 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/82011

  12. Torben Hansen rebased onto patch set 5 V +1 08/02/25, 17:12

  13. core-ci voted on patch set 5 V +1 08/02/25, 17:19 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/82669

  14. Oliver Klee voted on patch set 5 CR +1 V +1 08/03/25, 07:54

  15. Simon Praetorius uploaded patch set 6 CR +1 V +1 08/15/25, 13:28

  16. Simon Praetorius commented on patch set 6 CR +1 V +1 08/15/25, 13:30

    Reply

    I also prefer separate ViewHelpers as they make the template more readable. Since we can always add more arguments, but not easily remove them, I'd suggest to start with the minimalistic approach and see if `priority` etc. will become necessary later.
  17. core-ci voted on patch set 6 V +1 08/15/25, 13:36 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/83459

  18. Jörg Bösche voted on patch set 6 CR +1 08/18/25, 11:36

  19. Simon Schaufelberger commented on patch set 6 CR -1 08/20/25, 07:43

    FooterDataViewHelperTest.php:26

    this ViewHelper doesn't need a database. please disable the database initialization

    HeaderDataViewHelperTest.php:26

    same here
  20. Torben Hansen uploaded patch set 7 CR +1 V +1 08/20/25, 07:58

  21. Torben Hansen commented on patch set 7 08/20/25, 07:59

    FooterDataViewHelperTest.php:26 Reply

    Done

    HeaderDataViewHelperTest.php:26 Reply

    Done
  22. core-ci voted on patch set 7 V +1 08/20/25, 08:05 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/83663

  23. Oliver Klee voted on patch set 7 CR +1 V +1 08/20/25, 08:17

  24. Simon Praetorius voted on patch set 7 CR +2 V +2 08/29/25, 06:22

  25. Simon Praetorius merged patch set 8 08/29/25, 06:22