ProfileLabelEvent PHP types hinder internationalization

Created on 9 August 2023, over 1 year ago
Updated 13 October 2023, about 1 year ago

Problem/Motivation

As part of #3262489: Drop D8 support and address deprecations types were added to the ProfileLabelEvent class (see https://git.drupalcode.org/project/profile/-/commit/95bb86b3257095babb06...). However using a string type forces any instance of MarkupInterface like TranslatableMarkup to be converted to a string which loses the argument information and escapes string. If the result of that is passed to another instance of MarkupInterface the string will be escaped multiple times.

Steps to reproduce

$first = new TranslatableMarkup("Profile & label");
$event = new ProfileLabelEvent($profile, $first);
$result = new TranslatableMarkup("The string was @label", ["@label" => $event->getLabel()]);
echo $result;

The output of this is The string was Profile & label but the expected output is The string was Profile & label.

Proposed resolution

Ensure MarkupInterface is an accepted type so that it's not stringified.

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

RTBC

Version

1.0

Component

Code

Created by

🇳🇱Netherlands kingdutch

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

Comments & Activities

Production build 0.71.5 2024