Review main Merged

83626[FEATURE] Optimized integration of Page Rendering via Fluid

Benni Mack CR +2 V +2 Hard +602 −0 updated 04/03/24, 09:13

Commit message

This change adds a new cObject "PAGEVIEW" which has a much simpler
usage than "FLUIDTEMPLATE", because it is meant to render
a full page like this:

page = PAGE
page.10 = PAGEVIEW
page.10.paths.100 = EXT:site_extension/Resources/Private/Templates

Nothing else is needed by default, as
a) the layoutRootPaths are resolved to be meant to be under "Templates/Layouts" or "Templates/layouts"
b) the partialRootPaths are resolved to be meant to be under "Templates/Partials" or "Templates/partials"
automatically are added.

The name of the template is resolved from the Page Layout (Backend Layout)
identifier, so add a "Templates/Pages/Mypage.html" if there is a backend layout with "mypage" added.

In addition, the reserved variables
* site (Site object)
* language (Site Language object)
* page (Page object)
* settings (Page / TypoScript Settings)

are injected automatically, so the View can work with this information directly.

template folders for "pages", "layouts" and "partials" can start
with an upper-case or lower-case in order to ensure
maximum compatibility and avoid common mistakes.

Why do we do this?

We've found that FLUIDTEMPLATE is often used for page rendering,
but lacks specific usages for pages to be worked directly without
the understanding of Fluid internals and TypoScript code.

This functionality will be further adapted to be used for further rendering of
custom Content Elements and Content Blocks which will follow in
subsequent steps.

For this reason this API is considered experimental until TYPO3 v13 LTS.

Review

  • Code review CR +2 Done
    • Benni Mack +2
    • Oli Bartsch +1
    • Benjamin Kott +1
  • Verified V +2 Done
    • Benni Mack +2
    • Oli Bartsch +1
    • Benjamin Kott +1
    • core-ci +1 CI

Issues 1

Files 16

Review log 6493

Show 4668 earlier messages
  1. Benni Mack uploaded patch set 1 03/29/24, 21:33

  2. core-ci voted on patch set 1 V -1 03/29/24, 21:39 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/55070

  3. Benni Mack uploaded patch set 2 V -1 03/29/24, 21:48

  4. core-ci voted on patch set 2 V +1 03/29/24, 21:53 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/55071

  5. Benni Mack uploaded patch set 3 V +1 03/29/24, 22:24

  6. core-ci voted on patch set 3 V -1 03/29/24, 22:30 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/55072

  7. Benni Mack uploaded patch set 4 V -1 03/29/24, 22:33

  8. core-ci voted on patch set 4 V -1 03/29/24, 22:38 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/55073

  9. Benni Mack uploaded patch set 5 V -1 03/29/24, 22:42

  10. core-ci voted on patch set 5 V +1 03/29/24, 22:48 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/55074

  11. Benni Mack uploaded patch set 6 V +1 03/29/24, 22:51

  12. core-ci voted on patch set 6 V +1 03/29/24, 22:59 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/55075

  13. Benni Mack uploaded patch set 7 V +1 03/29/24, 23:00

  14. core-ci voted on patch set 7 V -1 03/29/24, 23:06 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/55076

  15. Benni Mack uploaded patch set 8 V -1 03/29/24, 23:12

  16. core-ci voted on patch set 8 V +1 03/29/24, 23:18 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/55077

  17. Nikita Hovratov uploaded patch set 9 V +1 03/30/24, 11:37

  18. Nikita Hovratov commented on patch set 9 03/30/24, 11:40

    Added an exception if template is not found. Otherwise user has blank page without error.
  19. core-ci voted on patch set 9 V -1 03/30/24, 11:43 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/55085

  20. Nikita Hovratov rebased onto patch set 10 V -1 03/30/24, 20:18

  21. core-ci voted on patch set 10 V +1 03/30/24, 20:23 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/55096

  22. Andreas Kienast commented on patch set 10 04/02/24, 07:10

    FluidPageContentObject.php:142

    Nitpick: Multiple `fn` can be static.
  23. Benjamin Kott commented on patch set 10 CR -1 04/02/24, 07:33

    FluidPageContentObject.php:115

    do we really need to set controller action?

    FluidPageContentObject.php:116

    do we really need to set the controller name?

    FluidPageContentObject.php:143

    `partials` should be preferred over `Partials`

    FluidPageContentObject.php:148

    it should not be allowed to set layoutRootPaths manually

    FluidPageContentObject.php:165

    `partials` should be preferred over `Partials`

    FluidPageContentObject.php:169

    it should not be allowed to set partialRootPaths manually
  24. Andreas Kienast commented on patch set 10 04/02/24, 07:49

    FluidPageContentObject.php:165 Reply

    Over the course of several TYPO3 releases, we encouraged people to use camel-cased directory names. Changing and forcing this now to lower-cased might become a breaking change, especially when TYPO3 projects are developed on case-insensitive file systems, but are deployed to case-sensitive systems.
  25. Benni Mack uploaded patch set 11 CR -1 V +1 04/02/24, 07:55

  26. core-ci voted on patch set 11 V +1 04/02/24, 08:01 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/55129

  27. Benni Mack uploaded patch set 12 V +1 04/02/24, 10:23

  28. Benni Mack commented on patch set 12 04/02/24, 10:25

    FluidPageContentObject.php:142 Reply

    Done

    FluidPageContentObject.php:143 Reply

    Done

    FluidPageContentObject.php:148 Reply

    Done

    FluidPageContentObject.php:169 Reply

    Done
  29. core-ci voted on patch set 12 V +1 04/02/24, 10:29 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/55149

  30. Benni Mack commented on patch set 12 04/02/24, 10:34

    FluidPageContentObject.php:115 Reply

    This is used to resolve the template name properly in Fluid (thus: pages/Mypagelayout.html)

    FluidPageContentObject.php:116 Reply

    This is used to resolve the template name properly in Fluid (thus: pages/Mypagelayout.html)

    FluidPageContentObject.php:165 Reply

    I built it in a way that both variants are allowed. We should slowly get to a point where we reduce the mental load of naming and have integrators (esp. them in this case) not care about the folder structure casing in the future.
  31. Benni Mack commented on patch set 13 V +1 04/02/24, 12:35

    Published edit on patch set 12.
  32. core-ci voted on patch set 13 V +1 04/02/24, 12:41 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/55164

  33. Benjamin Kott commented on patch set 13 CR -1 04/02/24, 12:50

    FluidPageContentObject.php:27

    PAGEVIEW

    FluidPageContentObject.php:45

    PageViewContentObject

    FluidPageContentObject.php:65

    PAGEVIEW

    FluidPageContentObject.php:110

    i am still unsure about configuring the rendering context. i understood that i´ts used to resolve the templates. but cannot we reduce it to only use setTemplate($layout) from the viewinterface?

    FluidPageContentObject.php:165 Reply

    Done

    FluidPageContentObject.php:233

    would remove the stdwrap here also

    FluidPageContentObject.php:253

    do we really want to support stdwrap here? if we at some point go further and even remove this capability we would need to be breaking here. i would suggest we only resolve the ext: syntax and do not allow additional processing here.
  34. Benjamin Kott commented on patch set 13 04/02/24, 12:51

    FluidPageContentObject.php:115 Reply

    Done

    FluidPageContentObject.php:116 Reply

    Done
  35. Oliver Hader commented on patch set 13 04/02/24, 13:12

    Feature-103504-NewContentObjectFLUIDPAGE.rst:109

    Change nesting to make before and after more comparable + add custom variable, e.g. ``` page.10 = FLUIDPAGE page.10 { templates { # refers to previous templateRootPaths, partial~, layout~ 100 = ... } variables { defaultLogoUri = TEXT defaultLogoUri.value = ${...} } dataProcessing { 10 = menu 10.as = mainMenu } } ```

    FluidPageContentObject.php:75

    Would it be possible to type-hint `$conf` for new cObjects?

    FluidPageContentObject.php:135

    Can be be "strict" here? E.g. either only uppercase or lowercase?

    FluidPageContentObject.php:180

    Use `!is_string(..)` instead?

    FluidPageContentObject.php:193

    Move this block to the top? Currently those internal variables would override custom assignments... Besides that: `language` vs `siteLanguage` (in `$this->reservedVariables`)

    FluidPageContentObject.php:230

    `is_array($conf['stdWrap.'] ?? null)` instead?

    FluidPageContentObject.php:244

    ... `&& is_array($paths)`?

    FluidPageContentObject.php:248

    `is_array($paths[$key . '.'] ?? null)` instead?

    FluidPageContentObject.php:251

    Check the result against `isAllowedAbsPath` - e.g. the result might be empty and should not be put to `$finalPaths`
  36. Benni Mack uploaded patch set 14 CR -1 V +1 04/02/24, 13:29

  37. Benni Mack commented on patch set 14 04/02/24, 13:31

    FluidPageContentObject.php:135 Reply

    see commit message and RST. It is added for backwards-compat

    FluidPageContentObject.php:193 Reply

    Done

    FluidPageContentObject.php:244 Reply

    Done

    FluidPageContentObject.php:251 Reply

    Done
  38. core-ci voted on patch set 14 V +1 04/02/24, 13:35 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/55167

  39. Benjamin Kott commented on patch set 14 04/02/24, 13:37

    FluidPageContentObject.php:110 Reply

    Done

    FluidPageContentObject.php:253 Reply

    Done
  40. Benni Mack uploaded patch set 15 V +1 04/02/24, 13:39

  41. core-ci voted on patch set 15 V +1 04/02/24, 13:44 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/55168

  42. Benni Mack commented on patch set 15 04/02/24, 13:51

    FluidPageContentObject.php:27 Reply

    Done

    FluidPageContentObject.php:45 Reply

    Done

    FluidPageContentObject.php:65 Reply

    Done

    FluidPageContentObject.php:233 Reply

    Done
  43. Benni Mack uploaded patch set 16 V +1 04/02/24, 13:57

  44. Benni Mack uploaded patch set 17 04/02/24, 13:58

  45. Benni Mack commented on patch set 16 04/02/24, 13:58

    Feature-103504-NewContentObjectFLUIDPAGE.rst:109 Reply

    Done

    FluidPageContentObject.php:75 Reply

    Due to Liskov, this does not work (we need to fix "AbstractContentObject" which is a breaking change :( )

    FluidPageContentObject.php:135 Reply

    Done

    FluidPageContentObject.php:180 Reply

    Done

    FluidPageContentObject.php:230 Reply

    Done

    FluidPageContentObject.php:248 Reply

    Done
  46. Benni Mack uploaded patch set 18 04/02/24, 14:02

  47. core-ci voted on patch set 17 V +1 04/02/24, 14:05 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/55175

  48. Kevin Appelt commented on patch set 18 04/02/24, 14:15

    Feature-103504-NewContentObjectPageView.rst:23

    page.10.paths.100 ?

    Feature-103504-NewContentObjectPageView.rst:123

    Use nesting here to make it more obvious that it's nested?
  49. core-ci voted on patch set 16 V +1 04/02/24, 14:17 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/55174

  50. core-ci voted on patch set 18 V +1 04/02/24, 14:17 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/55180

  51. Benni Mack uploaded patch set 19 V +1 04/02/24, 14:29

  52. core-ci voted on patch set 19 V +1 04/02/24, 14:35 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/55182

  53. Benni Mack commented on patch set 19 04/02/24, 14:56

    Feature-103504-NewContentObjectPageView.rst:23 Reply

    Done

    Feature-103504-NewContentObjectPageView.rst:123 Reply

    Done
  54. Benjamin Kott commented on patch set 16 CR -1 04/02/24, 15:01

    Feature-103504-NewContentObjectPageView.rst:42

    language

    Feature-103504-NewContentObjectPageView.rst:123

    please format the same way as above
  55. Benjamin Kott commented on patch set 19 CR -1 04/02/24, 15:04

    Feature-103504-NewContentObjectPageView.rst:123 Reply

    Done

    Feature-103504-NewContentObjectPageView.rst:125

    please format the same way as above
  56. Benni Mack uploaded patch set 20 CR -1 V +1 04/02/24, 15:11

  57. Benni Mack commented on patch set 19 04/02/24, 15:11

    Feature-103504-NewContentObjectPageView.rst:42 Reply

    Done

    Feature-103504-NewContentObjectPageView.rst:125 Reply

    Done
  58. core-ci voted on patch set 20 V +1 04/02/24, 15:17 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/55183

  59. Benni Mack uploaded patch set 21 V +1 04/02/24, 15:19

  60. core-ci voted on patch set 21 V +1 04/02/24, 15:26 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/55184

  61. Benjamin Kott voted on patch set 20 CR +1 V +1 04/02/24, 15:43

  62. Benni Mack updated the commit message in patch set 22 V +1 04/02/24, 15:53

  63. Benjamin Kott voted on patch set 22 CR +1 V +1 04/02/24, 15:54

  64. core-ci voted on patch set 22 V +1 04/02/24, 15:59 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/55185

  65. Nikita Hovratov commented on patch set 22 V -1 04/02/24, 16:54

    Please let's also have a test that lowercase "pages" works. Right now it tests only with "Pages".
  66. Garvin Hicking commented on patch set 22 04/02/24, 17:36

    FluidPageContentObject.php:165 Reply

    I like that casing is aimed to be irrelevant. But seeing a mixture of "Resources/Private/Templates" and then lowercase names in changelog&commit (and thus documentation later) looks odd to me and more like a typo that I would stumble upon. Couldn't a move to future lowercasing be made more consistently, and for the time being, promote the learned Uppercase to not unneccessarly confuse integrators, especially if they maybe have both FLUIDTEMPlATE and PAGEVIEW in effect at the same time?
  67. Benni Mack uploaded patch set 23 CR +1 V +1 04/02/24, 21:11

  68. Benni Mack updated the commit message in patch set 24 04/02/24, 21:12

  1. Benni Mack commented on patch set 24 04/02/24, 21:15

    FluidPageContentObject.php:165 Reply

    I took care of it in the RST and the commit message.
  2. core-ci voted on patch set 23 V -1 04/02/24, 21:19 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/55193

  3. core-ci voted on patch set 24 V -1 04/02/24, 21:20 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/55194

  4. Benni Mack uploaded patch set 25 V -1 04/02/24, 21:30

  5. core-ci voted on patch set 25 V -1 04/02/24, 21:36 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/55195

  6. Benni Mack uploaded patch set 26 V -1 04/02/24, 21:38

  7. core-ci voted on patch set 26 V +1 04/02/24, 21:42 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/55196

  8. Stefan Bürk commented on patch set 26 04/02/24, 22:44

    Feature-103504-NewContentObjectPageView.rst:38

    > lower-case or upper-case would mean "PAGES" or "pages", but from reading I would guess `Pages` and `pages` are meant .. so lower-case and upper-camel-case(ucfirst). Not that people assume that "PAGES" would work (on case-sensitve systems it won't).
  9. Garvin Hicking commented on patch set 26 04/03/24, 05:27

    Feature-103504-NewContentObjectPageView.rst:38 Reply

    I agree on that, maybe just write "can start with a lower-case or upper-case letter". (Also: s/burdon/burden) Thanks for adjusting this!
  10. Benni Mack commented on patch set 27 V +1 04/03/24, 05:31

    Published edit on patch set 26.
  11. Benni Mack commented on patch set 27 04/03/24, 05:31

    Feature-103504-NewContentObjectPageView.rst:38 Reply

    Done
  12. core-ci voted on patch set 27 V +1 04/03/24, 05:36 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/55201

  13. Benjamin Kott voted on patch set 27 CR +1 V +1 04/03/24, 06:40

  14. Oli Bartsch commented on patch set 27 CR -1 04/03/24, 06:42

    Reviewing
  15. Oliver Hader voted on patch set 27 CR +1 04/03/24, 06:57

  16. Georg Ringer voted on patch set 27 CR +1 V +1 04/03/24, 07:13

  17. Oli Bartsch uploaded patch set 28 CR +1 V +1 04/03/24, 07:53

  18. Oli Bartsch commented on patch set 28 CR +1 V +1 04/03/24, 07:54

    Reply

    Done
    Great Feature! 👍
  19. Oli Bartsch uploaded patch set 29 CR +1 V +1 04/03/24, 07:56

  20. core-ci voted on patch set 28 V +1 04/03/24, 07:59 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/55207

  21. core-ci voted on patch set 29 V +1 04/03/24, 08:03 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/55208

  22. Oli Bartsch voted on patch set 29 CR +1 V +1 04/03/24, 08:07

  23. Benjamin Kott voted on patch set 29 CR +1 V +1 04/03/24, 09:12

  24. Benni Mack voted on patch set 29 CR +2 V +2 04/03/24, 09:13

  25. Benni Mack merged patch set 30 04/03/24, 09:13