Make safe_join Twig filter return a Markup object

Created on 2 October 2015, over 8 years ago
Updated 4 April 2024, 3 months ago

Problem/Motivation

If you have some safe strings and you want to safe_join them in a template and pass that as a @placeholder for translation, they get escaped even though they are safe. safe_join actually breaks the Markup object wrapper.

Why this should be an RC target

Without this patch any Markup instance passed to the |safe_join() Twig filter will be unintentionally escaped.

Disruptions: None, the intended result of this is to concatenate strings safely and return them joined by a separator and each item escaped if an item is not already a Markup instance.

Proposed resolution

Make the safe_join filter return a Markup object.

Remaining tasks

User interface changes

Less things getting accidentally escaped.

API changes

safe_join will return a TwigMarkup/Markup object rather than a string.

Data model changes

None

Why this should be an RC target

Expectations of how safe_join works with MarkupInterface will be way off and this is not disruptive.

📌 Task
Status

Needs work

Version

11.0 🔥

Component
Theme  →

Last updated about 4 hours ago

Created by

🇨🇦Canada Cottser

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.69.0 2024