{{ tp_image() }} Rendered HTML appears as escaped text instead of <img>

Created on 31 March 2025, 5 days ago

Problem/Motivation

When using {{ tp_image() }} in Twig, the image is not rendered correctly. Instead, the tag is displayed as plain text in the frontend.

Steps to reproduce

1. Install and enable the twig_placeholders module.
2. Use one of your components and add {{ tp_image() }} where a placeholder image should appear.
3. View the rendered page in a browser.
4. Instead of displaying an actual image, the HTML tag is rendered as plain text in the frontend.

Proposed resolution

Render image using Drupal render array.

Remaining tasks

Use Drupal render array system when rendering image.
Update tests to check render array keys instead of string.

User interface changes

None.

API changes

None.

Data model changes

Use render array instead of string.

🐛 Bug report
Status

Active

Version

1.0

Component

Code

Created by

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