Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Using Rocketship layouts and paragraphs causes paragraphs to go through rendering twice. (this in turn causes issues with advanced forms if you have a paragraph that references a form)
{% if content.top is not empty and content.top|render|striptags|length %}
<div class="layout__region layout__top {{'layout__' ~ 'top' ~ '--' ~ entityType ~ '--' ~ bundle ~ '--' ~ viewMode }}">
{{ content.top }}
</div>
{% endif %}
This extra check where the content is rendered in the template causes the issue. When I remove that extra check the build is rendered correctly.
Comment | File | Size | Author |
---|---|---|---|
#4 | 31376601-4.patch | 13.89 KB | nielsaers |
Comments
Comment #2
nielsaers CreditAttribution: nielsaers commentedCreated a quick patch that removes the logic for rendering the content in the templates. It might need some looking into why the empty check was not enough.
Comment #3
nielsaers CreditAttribution: nielsaers commentedComment #4
nielsaers CreditAttribution: nielsaers commentedCreated another patch that actually brings back the functionality of conditional regions but only renders the output once. So the downside is that the entire contents get rendered in the twig file.
As with the related issue, there is no real fix yet that takes into account all the edge cases. (e.g. bigpipe,...)
Resources: https://www.lullabot.com/articles/level-your-twiggery#checking-field-is-...
Comment #5
nielsaers CreditAttribution: nielsaers commentedComment #7
rembrandx CreditAttribution: rembrandx at Dropsolid commentedPatch 4 applied and adding to new release (alpha 6), thanks @Niels! Sorry it took a while to get in.
Comment #9
nginex CreditAttribution: nginex at Dropsolid for Dropsolid commentedBackported existing patch to 8.x-1.x, will be available in new release