Text field filter format not passed, breaking trimmed HTML output

Created on 16 January 2021, almost 4 years ago
Updated 12 February 2024, 11 months ago

Problem/Motivation

When using a text field in the Layout Builder, the HTML filter format is not passed to text_summary, causing broken HTML to be outputted when the text field contains HTML (such as p

Steps to reproduce

- Add a long "lorem ipsum" paragraph to a text field in a node. The field should use "Full HTML" with HTML correction enabled.
- Add the text field to a Layout Builder page.
- Layout Builder configuration: select "Formatter" as "trimmed". Select "200" for the "Trimmed limit".

The expected output would be:

<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>

The actual output is:
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.

Doing some debugging, it seems the format of the text field is not passed to text_summary($text, $format = NULL, $size = NULL), hence the text field content does not respect the HTML filter of the field.

Proposed resolution

Ensure all text fields pass the filter format, guaranteeing the text is processes correctly by text_summary

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

🐛 Bug report
Status

Closed: duplicate

Version

9.5

Component
Layout builder 

Last updated 4 days ago

Created by

🇮🇹Italy andrewsuth

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024