[2.0.0-rc1] Empty slot values when not renderable

Created on 10 December 2024, about 1 month ago

Problem/Motivation

As a follow-up of ✨ Empty field values when not renderable Active , it seems some use case were not covered by the previous MR, because it relies on Element::getVisibleChildren() method from Core which may not be enough.

Proposed resolution

Missing case: empty markup

  $variables['test'] =  [
    "#markup" => "",
  ];

{{ test ? "true" : "false" }}

Result: true but we need false. So what do we do? We empty the array to get $variables['test'] = [] ?

Missing case: empty plain_text

  $variables['test'] =  [
    "#plain_text" => "",
  ];

{{ test ? "true" : "false" }}

Result: true but we need false. So what do we do? We empty the array to get $variables['test'] = [] ?

What else?

Which other use case we can think about?

Unit/Kernel tests

We need the tests for the new use cases and maybe for the ones from ✨ Empty field values when not renderable Active ,

Triggering

Today, we trigger this "cleaning" in the Render Element. So, the components called from Twig doesn't benefit from it. Do we move the logic (or some parts of the logic) in SlotPropType::normalize() ?

πŸ› Bug report
Status

Active

Version

2.0

Component

Code

Created by

πŸ‡«πŸ‡·France pdureau Paris

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024