- Issue created by @pdureau
- 🇧🇪Belgium tim-diels Belgium 🇧🇪
Not sure if this is the right approach, but we fixed it in our setup with the attached patch.
We would love to discuss this if there are other ways to fix this. - 🇫🇷France pdureau Paris
Hi Tim,
Your proposal is interesting. It works only for layouts but maybe it is enough and we don't need a more generic solution. For exeample, this issue is about layouts: 🐛 Drupal entities containing optional or multiple fields do not render patterns correctly Closed: won't fix
However, you are dealing only with empty #cache and #weight values:
['#cache' => [], '#weight' => NULL];
We need to deal also with non empty #cache values, and bubble them.keys
- 🇫🇷France fb-multimedia
Not sure of the issue, but I've you try simply using the |render filter, like this :
{% if description|render %}
{{ description }}
{% endif %}
- 🇮🇳India ravi kant Jaipur
{% if description.0 is not empty %}<p class="fr-tile__desc">{{ description }}</p>{% endif %}
- 🇮🇳India ravi kant Jaipur
{% if description|render|trim %}<p class="fr-tile__desc">{{ description }}</p>{% endif %}
- 🇧🇪Belgium tim-diels Belgium 🇧🇪
Hey Pierre,
I did not have the full context there on what could all be possible, so just made something so our team had something working.
Happy to discuss this approach and see if we get there with this approach or if it does something different.I understand what you say with none empty #cache and maybe non empty #weight values.
You have an idea on how to bubble the cache keys?@fb-multimedia and @ravi kant Those are not solutions as you can read in the original D.O. core issue.
- Status changed to Postponed
8 months ago 12:38pm 23 October 2023 - 🇫🇷France pdureau Paris
Let's move this to 2.x now the development rbanch is open and active.
However, not in the scope of 2.0.0, so let's target 2.1.x
- 🇫🇷France pdureau Paris
If the issue is found only in Layout Builder, we can do the fix in:
- https://www.drupal.org/project/ui_patterns_layout_builder → for UI Patterns 1.x
- ui_patterns_layout for UI Patterns 2.x
- 🇫🇷France pdureau Paris
We also have this weird behaviour with empty markup:
$variables['test'] = [ "#markup" => "", ];
{{ test ? "true" : "false" }}
Result:
true
Maybe we have to create an issue for Drupal Core.
- Status changed to Active
4 months ago 9:36am 5 March 2024