i have this configuration:
config header
config header 2

if there are no results the view print: {{ 'News'|t }}
Error header view twig

if there are results instead it is correctly printed

(this issue don't fix this problem: https://www.drupal.org/node/2610236)


BOESbo created an issue. See original summary.

BOESbo’s picture

Title: Views - Global: Text area (Global: Text area) if there are no results » Views - Global: Text area (Global: Text area) don't parse twig if there are no results
BOESbo’s picture

Priority: Normal » Major
joshi.rohit100’s picture

I think there needs some discussion around what to be shown if no data as then token will have nothing to replace. Should be show as it is (no change) or just remove or return no data (empty).

BOESbo’s picture

! @joshi, so there is no way to insert strings with T?

Lendude’s picture

jonathanshaw’s picture

Agreed. We've got 4 choices:
1) Always parse twig, but set first row as variables for twig depending on this UI "Use replacement tokens from first row" setting
2) Always parse twig, and always add the first row as variables, abandon the UI setting
3) Make a new setting additional "Process the input using Twig", and only offer the "Use replacement tokens from first row" if that is checked
4) Replace the current setting with a single "Process the input using Twig" setting

I'd suggest #2 is best - what's the point of these UI settings? Everything is presumably cached to the 11th degree, so I imagine there's no performance issue, and as long as we support Twig escaping then the twig parsing is not blocking anything a sitebuilder might want to do.