Don't escape title and prefix when cloning translations

Created on 4 October 2022, over 2 years ago
Updated 13 January 2025, 22 days ago

Problem/Motivation

When cloning a node the title of any translations it has is set by this bit of code in QuickNodeCloneEntityFormBuilder.php

      $translated_node->setTitle($this->t('@prepend_text@title',
        [
          '@prepend_text' => $prepend_text,
          '@title' => $translated_node->getTitle(),
        ],
        [
          'langcode' => $langcode,
        ]
      )
      );

Which causes both both of the @prepend_text and @title attributes to be escaped and mangled if they contain any of the characters processed by Html::escape

Steps to reproduce

  • Create a node, set title to "Don't escape me"
  • Add a translation, keep the same title
  • Clone the original node
  • The title of the cloned translation ends up as "Clone of Don't escape me"

Proposed resolution

Use Drupal\Core\Render\Markup::create() to prevent escaping of these strings.

πŸ› Bug report
Status

RTBC

Version

1.0

Component

Code

Created by

πŸ‡±πŸ‡»Latvia artis.bajars

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.

Production build 0.71.5 2024