Quantcast
Viewing all articles
Browse latest Browse all 295807

{% trans %} does not support render array and MarkupInterface valued placeholders

Problem/Motivation

Noticed in #2226493: Apply formatters and widgets to Node base fields. Right now you get warnings and errors.

Right now {% trans %} only allows strings to be passed in and using render arrays is not possible. Being able to use render arrays in node.html.twig would allow us to simplify template_preprocess_node().

Proposed resolution

Change this line:
$compiler->string($token->getAttribute('placeholder'))->raw(' => ')->subcompile($token)->raw(', ');
in TwigNodeTrans.php

API changes

Allows common values to be rendered in Trans tag.

Before

Image may be NSFW.
Clik here to view.

After

Image may be NSFW.
Clik here to view.


Viewing all articles
Browse latest Browse all 295807

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>