0

Some of my body fields contain embedded code, like iFrame. I use the Views to rewrite the output for a better layout and style. However, the iFrame tag got stripped when replacement patterns were used on Rewrite Results. I also tried the Preserve Certain Tags option under the Strip HTML tags, but it does not work either.

Is this a known issue? Interestingly, the iFrame can render in the Views without resorting to rewrite results.

Here is my sample of rewrite results with replacement patterns. It stripped the iFrame that is contained in the Body field.

<div class="StyleWrapper">
    <div class="StyleTitle">{{ title }}</div>
    <div class="StyleContent">{{ body }}</div>
</div>

Update: I tested this on 7, 8, 9, and 10. This behavior is applied to versions 8+.

8
  • If body|raw works then this is ordinary Twig escaping. But the raw filter is intrinsically unsafe. See also (possibly): drupal.stackexchange.com/questions/257171/…
    – mona lisa
    Commented Apr 1 at 19:24
  • The iFrame also got stripped using body|raw in Views.
    – CocoSkin
    Commented Apr 1 at 19:27
  • Is is stripped or escaped?
    – mona lisa
    Commented Apr 1 at 19:43
  • They got stripped.
    – CocoSkin
    Commented Apr 1 at 19:56
  • 1
    See my answer here, same principal.
    – No Sssweat
    Commented Apr 3 at 18:16

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.