Checking for rendered content within block template results in XB's editor breaking

Created on 20 May 2025, 19 days ago

Within my block.html.twig, I'm preventing extra markup by doing the following if statement. It's hacky, but it's what core gives us.

{% if content|render|striptags('<drupal-render-placeholder><a><img><hr><br><iframe><video>')|trim %}

The code above is adapted from https://www.lullabot.com/articles/level-your-twiggery#checking-field-is-...

Unfortunately, this breaks the XB component placement, as XB adds a DIV with data-xb-region attribute.

It would be nice if the template could know it's rendering via XB, or if there's a better way to do this.

πŸ› Bug report
Status

Active

Version

0.0

Component

Page builder

Created by

πŸ‡ΊπŸ‡ΈUnited States mherchel Gainesville, FL, US

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

Comments & Activities

Production build 0.71.5 2024