Text formats are not applied

Created on 20 November 2020, about 4 years ago
Updated 2 April 2024, 8 months ago

Problem/Motivation

Text formats are not being applied when the output is rendered. I noticed it when I was reviewing why the embed module didn't work on those fields where the readmore formatter where applied.
It might enter in conflict when we use the theme 'readmore' but it should be ease to solve when we don't apply it (case when the text doesn't need to be trimmed).

Steps to reproduce

  • Configure a text field to use the readmore formatter
  • Configure it to trim the text at 250 chars.
  • Create a content with a text shorter than 250 chars
  • Note none text formats are applied and the text is returned as it is.

Proposed resolution

I suggest to define a fallback renderer to be used on case we don't apply the readmore theme. It would use the processed_text as theme.

🐛 Bug report
Status

Needs review

Version

2.0

Component

Code

Created by

🇪🇸Spain jlbellido

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

Merge Requests

Comments & Activities

Not all content is available!

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

  • First commit to issue fork.
  • Open on Drupal.org →
    Core: 10.1.4 + Environment: PHP 7.3 & MySQL 8
    last update 12 months ago
    Waiting for branch to pass
  • Open on Drupal.org →
    Core: 10.1.4 + Environment: PHP 7.3 & MySQL 8
    last update 12 months ago
    Waiting for branch to pass
  • Status changed to Needs review 12 months ago
  • 🇧🇪Belgium matthijs

    I created an MR that uses the processed text and truncates the HTML without removing/breaking HTML tags or entities.

  • Open on Drupal.org →
    Core: 10.2.1 + Environment: PHP 7.3 & MySQL 8
    last update 8 months ago
    Waiting for branch to pass
  • 🇧🇪Belgium keszthelyi Brussels

    @Matthijs I tested your MR on our project and so far it's working great, thank you! I need a fixed patch file because of our CI pipeline, so I upload a patch version from it (at commit d144a36e).

    Currently, the module is not handling processed text correctly IMO, and this seems to have security implications also in certain cases, besides not applying the formatting. I'm planning to report that separately, but I will reference this issue (and your MR) as a possible solution.

  • Open on Drupal.org →
    Core: 10.2.1 + Environment: PHP 7.3 & MySQL 8
    last update 8 months ago
    Waiting for branch to pass
  • 🇧🇪Belgium keszthelyi Brussels

    This patch is almost identical to #8 which is created from @Matthijs' MR. The only difference is that I added support for plain text fields (to handle cases when the processed property is empty for the field).

Production build 0.71.5 2024