The use of the t() function on line 83 of /src/Plugin/Field/FieldFormatter/ViewsReferenceFieldFormatter.php is causing the double escaping of special characters such as &.

Comments

jerdavis created an issue. See original summary.

NewZeal’s picture

Are you referring to the title as follows?:

$title_render_array = array(
          '#markup' => '<div class="viewsreference-title">' . t('@title', ['@title'=> $title]) . '</div>'
 );

It's probably the @ which is cleaning out the ampersand. I'll change to ! in the next release and we can see if that helps.

znak’s picture

Status: Active » Needs review
StatusFileSize
new727 bytes

Patch for your module

joekers’s picture

StatusFileSize
new711 bytes

Thanks for your patch but it looks like the "!" placeholder has now been removed so we get the following error:
Invalid placeholder (!title) in string: !title in Drupal\Component\Render\FormattableMarkup::placeholderFormat() (line 235 of core/lib/Drupal/Component/Render/FormattableMarkup.php).

It seems like strings are sanitised in t() so we shouldn't need any placeholders here, try the attached patch.

NewZeal’s picture

Can people download the latest dev code, check this change is in the code, test and report back so we can go beta: https://www.drupal.org/node/2846411

joekers’s picture

Status: Needs review » Fixed

I've tested again and it's working for me - marking as fixed.

Status: Fixed » Closed (fixed)

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