Project

General

Profile

Actions

Feature #101752

closed

Add event to the Typoscript FE Controller to let the users replace nested TS constants

Added by Julian Mair 8 months ago. Updated 3 months ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
TypoScript
Target version:
-
Start date:
2023-08-25
Due date:
% Done:

100%

Estimated time:
PHP Version:
8.2
Tags:
Complexity:
Sprint Focus:

Description

As mentioned in #101523, nested (= recursive) Typoscript constants doesn't work anymore since Typo3 v12 cause of the newly introduced TypoScript Parser.
To be fair: it was never a promised/documented feature and there were valid reasons to not implement this in core anymore.

One main reason is that I did not find an acceptable simple solution to implement this better than "O(m) * O(n)" with m being the substitution depth and n the number of nodes in the tree.
(https://forge.typo3.org/issues/101523#note-12)

I hope, even if the core won't implement a complete implemention of this feature, there will be at least an option (like an event or hook) to substitute potential nested constants under the responsibility by the user itself.

Solution:
After the merge (or apply via composer patches) of the patch https://review.typo3.org/c/Packages/TYPO3.CMS/+/81078 the extension https://packagist.org/packages/m41r/nested-typoscript-constants can be installed as a drop-in-replacement. No further code adjustments needed.

Suggestion:
Dispatch an event after line: https://github.com/TYPO3/typo3/blob/v12.4.5/typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php#L1321 to adjust the $flatSettings property in \TYPO3\CMS\Core\TypoScript\FrontendTypoScript:class (a setter has to be added)

Requested target version:
>= Typo3 v12


Related issues 2 (0 open2 closed)

Related to TYPO3 Core - Bug #101523: Config `page.config.headerComment` can not resolve TS constants anymoreRejected2023-08-01

Actions
Related to TYPO3 Core - Feature #97816: New TypoScript parserClosed2022-06-27

Actions
Actions #1

Updated by Georg Ringer 8 months ago

  • Related to Bug #101523: Config `page.config.headerComment` can not resolve TS constants anymore added
Actions #2

Updated by Christian Kuhn 8 months ago

Actions #3

Updated by Christian Kuhn 8 months ago

Yeah, I came to the same conclusion that we need an event after constant calculation and before setup calculation for extensions to hook in there.

The actual solution / event placement depends a bit on the future fate of the method: It will of course vanish from TSFE and will be put into a middleware (or an extracted factory, maybe with muliple methods, unsure). It might be good to see a bit where this leads to in order to not introduce new b/w compat issues as soon as we do so in v13.

Note: I guess we don't need a setter for the attribute class since an event could just return a new attribute instance. But those are details and involved classes are @internal at the moment anyways ... maybe that's the solution for now: mark an event as "@internal, may change" for now, but still add it. This would reduce the upwards compat issues and if we break it, extensions would have to adapt.

Depending on how we model and inject a future factory, it may even be possible to go without an event, altogether, so an event may be an intermediate solution anyways. Unsure here, too.

Actions #4

Updated by Julian Mair 8 months ago

Hey Christian,

just a quick inquiry: Have you already formulated a plan for implementing the event, or do you have any alternative solutions in mind? I don't mean to rush you; however, I need to provide my supervisors with an interim response. The absence of nested constants is a significant impediment for us in considering the usage or upgrade to Typo3 v12.

Actions #5

Updated by Gerrit Code Review 7 months ago

  • Status changed from New to Under Review

Patch set 1 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/81078

Actions #6

Updated by Gerrit Code Review 7 months ago

Patch set 2 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/81078

Actions #7

Updated by Gerrit Code Review 7 months ago

Patch set 3 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/81078

Actions #8

Updated by Gerrit Code Review 6 months ago

Patch set 4 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/81078

Actions #9

Updated by Gerrit Code Review 6 months ago

Patch set 5 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/81078

Actions #10

Updated by Gerrit Code Review 6 months ago

Patch set 6 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/81078

Actions #11

Updated by Gerrit Code Review 6 months ago

Patch set 7 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/81078

Actions #12

Updated by Julian Mair 6 months ago

  • Description updated (diff)
Actions #13

Updated by Julian Mair 6 months ago

A solution was provided above in the description field

Actions #14

Updated by Gerrit Code Review 6 months ago

Patch set 1 for branch 12.4 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/81652

Actions #15

Updated by Julian Mair 6 months ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
Actions #16

Updated by Benni Mack 3 months ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF