Problem/Motivation

Special characters are shown as HTML entities, should be as they are.

Steps to reproduce

Add Content Type named A & B
Hover toolbar: Content >> Add content, you will see A & B

Proposed resolution

Revert changes in Drupal\admin_toolbar_tools\Plugin\Derivative\ExtraLinks getDerivativeDefinitions():

// not working properly v2.4
'title' => $this->t('@label', ['@label' => $type->label()]),
//working properly v2.3
'title' => $this->t($type->label()),

Comments

pawel_r created an issue. See original summary.

saltwaterskin’s picture

StatusFileSize
new2.63 KB

Resolving the issue as suggested would violate coding standards. This is not likely to be committed but removing the calls to the t() function is likely the best way to resolve this. Here is a patch that removes the calls to the t() function and resolves the encoding issues.

scott weston’s picture

StatusFileSize
new23.48 KB
new20.79 KB

Reviewed and tested the patch using simplytest.me on Drupal 8.9.11.

Without the patch Content Type named "A & B" appears as:

Without Patch:

Menu with no patch

With Patch:

Menu with patch

scott weston’s picture

Status: Active » Needs review

Moving to NR for others to review.

adriancid’s picture

Status: Needs review » Fixed

Thanks

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

n.dhuygelaere’s picture

You can also use this way :


use Drupal\Component\Render\FormattableMarkup;
$this->t('@label', ['@label' => new FormattableMarkup($type->label(), [])]),