- Issue created by @pdureau
- 🇫🇷France pdureau Paris
https://github.com/twigphp/Twig/issues/3828 has resumed!
So, if you want to wait the upstream, this issue will only be for the prerender.
Moved to alpha3
- Status changed to Needs work
5 months ago 8:02pm 8 June 2024 - 🇫🇷France pdureau Paris
Upstream PR ready for review: https://github.com/twigphp/Twig/pull/3859
- Status changed to Postponed
5 months ago 12:59pm 10 June 2024 - 🇫🇷France pdureau Paris
Merged: https://github.com/twigphp/Twig/commit/045f5adec773f6430676fdda078b2fa39...
So, we keep this issue for this remaining task.
However,
is sequence
test is not enough when a list of renderables has mapping keys (non consecutive, strings) instead of sequence (integer, consecutive) keys.For example a list of blocks from page layout or layout builder: each block is keyed by its UUID.
In other words:
- in Drupal, a unique renderable is always an associative array ("mapping"). In Twig, it is always a mapping. So it is OK.
- in Drupal, a list of renderables can be a list array ("sequence") or sometimes an associative array ("mapping"). In Twig, it must always be a sequence.
- When a list of renderables is an associative array in Drupal, the keys are meaningless, just traversable, and can be removed. So let's remove them before sending them to Twig in a prerender method.
- UI Patterns is a perfect place to do that because we know which variables expects renderables (slots/fields) and which are not (props/settings). It would not be easy at a Drupal core level. Same with ✨ Empty field values when not renderable Active
So, add a rule to SlotPropType::normalize() to transform this list of renderable to a proper Twig sequence, on the first level of each slot, no recursivity.
Be careful to not break layout builder :)
1.x implementation has its own specific issue : ✨ Make the Twig loops safer Postponed
- Issue was unassigned.
- Status changed to Fixed
4 months ago 7:28pm 5 July 2024 Automatically closed - issue fixed for 2 weeks with no activity.