Review main Merged

81078[TASK] Have an event to modify constants AST in FE

Julian Mair CR +2 V +2 Easy +48 −0 updated 11/02/23, 15:00

Commit message

The new v12 TypoScript parser removed one undocumented
feature of the old parser in particular: Nested constants.

The core does not implement this anymore since it is
extremely hard to find a solution that scales well. The
problem becomes complicated with recursive usage
combined with values that may change at any point.

There are however a couple of instances that need this
feature and can't migrate away easily or at least not
without giving them a longer transition timeframe.

For this reason, the patch introduces an event in the
Frontend rendering chain that allows listeners to
manipulate the calculated constants AST structure.
This gives event listeners a chance to traverse the
calculated FE constants AST before it is cached and
further processed.

Implementing a resolver of nested constants should be
possible this way, even though extensions probably
restrict their implementation to limited scenarios.

This event is essentially a "last resort" solution: It
works in an environment where the AST is still marked
internal, and where the dispatching may still be
moved around to other places.

As such, this event is *not* marked as official feature.
It does not come with a ReST file, and it may change or
vanish in future major versions in case it becomes a
headache during further development. It is tailored for
developers who can't move away from nested constants and
need an intermediate solution right now.

Review

  • Code review CR +2

    Imported before Forger kept the single votes, the next import adds them.

  • Verified V +2

    Imported before Forger kept the single votes, the next import adds them.

Issues 1

Files 2