Review main Merged

73599[BUGFIX] Resolve default value in f:translate on time

Oli Bartsch CR +2 V +2 Easy +15 −5 updated 02/18/22, 12:55

Commit message

Some components in the Core allow to either define
locallang references or static labels. To process them
in a template, usually the f:translate ViewHelper is used.

Since the value will be dynamically and a static label
as "key" will lead to an exception in non extbase context,
the dynamic value must also be defined as the default,
which will be used by the ViewHelper, in case the "key"
can not be resolved.

There are two possibilities to define the default. Either
by setting the "default" attribute or by adding the value
as tag content. Latter failed since #96473 because the
tag content was resolved too late.

The previous behaviour is now restored by evaluating
a possible default value before processing the "key".

Review

  • Code review CR +2 Done
    • Oli Bartsch +2
    • Stefan Bürk +1
    • Christian Kuhn +1
  • Verified V +2 Done
    • Oli Bartsch +2
    • Stefan Bürk +1
    • Christian Kuhn +1
    • core-ci +1 CI

Issues 2

Files 2

Review log 1014

  1. Oli Bartsch uploaded patch set 1 02/18/22, 11:03

  2. Oli Bartsch updated the commit message in patch set 2 02/18/22, 11:03

  3. core-ci voted on patch set 1 V +1 02/18/22, 11:11 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/23868

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

  5. Oli Bartsch commented on patch set 2 CR -1 02/18/22, 11:16

    Will add a test
  6. Oli Bartsch uploaded patch set 3 02/18/22, 11:22

  7. Oli Bartsch commented on patch set 3 CR -1 02/18/22, 11:29

    Test currently not executed, on it.
  8. core-ci voted on patch set 3 V -1 02/18/22, 11:31 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/23870

  9. Oli Bartsch uploaded patch set 4 02/18/22, 11:54

  10. core-ci voted on patch set 4 V +1 02/18/22, 12:07 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/23871

  11. Christian Kuhn commented on patch set 4 V +1 CR +1 02/18/22, 12:32

    good catch! we should add a
  12. Stefan Bürk commented on patch set 4 V +1 CR +1 02/18/22, 12:42

    nice. Alternatively we "could" switch to "CompileWithContentArgumentAndRenderStatic" trait instead and add following method: ``` /** * Explicitly set argument name to be used as content. */ public function resolveContentArgumentName(): string { return 'default'; } ``` than we could simply use renderingChildrenClosure(). ``` $default = $renderChildrenClosure() ?? ''; ``` Comment of registerend argument already metionens this behaviour, which this trait is capable of (with magic) which can be manual hardend to a specific argument with this technic. Example: https://review.typo3.org/c/Packages/TYPO3.CMS/+/73014/7/typo3/sysext/core/Classes/ViewHelpers/NormalizedUrlViewHelper.php#64 I will vote this as this is a legitim working patch, just wanted to throw the "alternative" into the comments.
  13. Oli Bartsch commented on patch set 4 V +2 CR +2 02/18/22, 12:55

    Reply

    Tbh, I don't see the benefit of such magic.
  14. Oli Bartsch merged patch set 5 02/18/22, 12:55