Review main Merged

72966[TASK] Simplify Templating Bootstrap in BE Controllers

Christian Kuhn CR +2 V +2 Hard +170 −119 updated 01/12/22, 11:21

Commit message

This patch introduces a new EXT:fluid view class
"BackendTemplateView" to be used as main view for
backend-related non-Extbase views.

This class is the base of a new non-Extbase and
non-request dependent backend view. The class is for
now marked @internal and experimental since we'll
probably add a factory to configure backend template
overrides for any backend view later-on.

A few ViewHelpers are changed to work without
accessing the request if enough VH arguments are provided.

This is the first patch in a series of patches that will
switch from StandaloneView usages in backend
controllers to this new BackendTemplateView.

Basic strategy:
* $view->getRequest()->setControllerExtensionName('SysNote')
  is removed. This is Extbase-specific and not needed nor
  wanted for common non-Extbase controllers.
* Instantiate the View (for now with makeInstance, will be
  replaced with a factory later-on)
* Set the needed paths via ->setTemplateRootPaths() etc.
  For these, we *always* use the main extension's entry
  templating paths, for instance
  'EXT:sys_note/Resources/Private/Templates' or
  'EXT:sys_note/Resources/Private/Partials'.
  We do *not* use sub directories here to clear up path
  logic.
* ->assign() / ->assignMultiple() whatever is needed.
* ->render('SubDirectory/TemplateName') the actual
  action / template, no '.html' suffix.

As a demo, EXT:sys_note is adapted accordingly which hands
over arguments to the above mentioned VH's in a way so
these don't access the request object anymore. The sys_note
code gets a couple of additional changes so the hooks can
prepare request dependent arguments and set them as
template variables (here: returnUrl).

This patch triggers a hidden gem: Since ViewHelpers no
longer receive an Extbase request, they also don't trigger
Extbase magic anymore. The casual victim here is
f:translate, which has already been prepared to not trigger
Extbase's frontend TypoScript parsing if there is no
Extbase request. This often improves backend view performance
by 25% or more, depending on the amount of frontend
TypoScript to parse.

Further patches will adapt other core backend routes and will
relate to this patch for reference.

Review

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

Issues 2

Files 14

Review log 1624

  1. Christian Kuhn uploaded patch set 1 01/11/22, 12:37

  2. core-ci voted on patch set 1 V -1 01/11/22, 12:52 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/21906

  3. Christian Kuhn uploaded patch set 2 01/11/22, 15:05

  4. core-ci voted on patch set 2 V +1 01/11/22, 15:22 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/21915

  5. Christian Kuhn uploaded patch set 3 01/11/22, 17:24

  6. core-ci voted on patch set 3 V +1 01/11/22, 17:37 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/21921

  7. Christian Kuhn uploaded patch set 4 01/11/22, 17:56

  8. Christian Kuhn uploaded patch set 5 01/11/22, 17:59

  9. Christian Kuhn updated the commit message in patch set 6 01/11/22, 18:04

  10. Christian Kuhn updated the commit message in patch set 7 01/11/22, 18:06

  11. core-ci voted on patch set 4 V -1 01/11/22, 18:16 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/21923

  12. core-ci voted on patch set 5 V -1 01/11/22, 18:22 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/21924

  13. core-ci voted on patch set 6 V +1 01/11/22, 18:24 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/21926

  14. core-ci voted on patch set 7 V +1 01/11/22, 18:30 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/21927

  15. Benni Mack updated the commit message in patch set 8 01/11/22, 20:47

  16. Benni Mack commented on patch set 8 CR +1 01/11/22, 20:49

    InfoModuleHook.php:39

    NICE!
  17. core-ci voted on patch set 8 V +1 01/11/22, 21:03 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/21938

  18. Benni Mack commented on patch set 8 V +1 01/11/22, 21:09

    InfoModuleHook.php:39 Reply

    Done
  19. Benjamin Franzke commented on patch set 8 01/11/22, 21:24

    BackendTemplateView.php:26

    I'd love if we'd rather use https://github.com/TYPO3/Fluid/blob/master/src/View/TemplateView.php instead of generating a new TemplateView class. The upcoming factory can then easily create a vanilla fluid template view. I do not see the reason for a separate class in here.
  20. Benni Mack commented on patch set 8 01/11/22, 21:30

    BackendTemplateView.php:26 Reply

    The idea is to use this class for now and migrate the TYPO3 Backend completely to not use StandaloneView anymore. I plan to then integrate https://review.typo3.org/c/Packages/TYPO3.CMS/+/72794 and - at this point, we should use DI properly, and remove the class again, OK?
  21. Benjamin Franzke commented on patch set 8 01/12/22, 10:23

    BackendTemplateView.php:26 Reply

    OK, yea.
  22. Oli Bartsch voted on patch set 8 V +1 CR +1 01/12/22, 11:20

  23. Christian Kuhn voted on patch set 8 V +2 CR +2 01/12/22, 11:21

  24. Christian Kuhn merged patch set 9 01/12/22, 11:21