- Issue created by @Grimreaper
- 🇫🇷France Grimreaper France 🇫🇷
Workaround solution like putting the variables into a render array with markup does not work because some tags are escaped and it is not possible to list manually every possible tags:
{ '#markup': column_content, }
When printing in the presenter template the column_content variable there is no problem.
If I setup a column_content variable with
{% set column_content = '<p>foo</p>' %}
, no problem when passed into the component. When using the "set" on an "area" in twig, then we obtain a Twig/Markup object and not directly the generated HTML.The problem is in app/core/lib/Drupal/Core/Render/Renderer.php::ensureMarkupIsSafe:
if (isset($elements['#plain_text'])) { $elements['#markup'] = Markup::create(Html::escape($elements['#plain_text'])); }
This is where the escape comes from. But in SDC, the only place where plain_text is used is in app/core/lib/Drupal/Core/Render/Element/ComponentElement.php::generateComponentTemplate:
if (\is_scalar($slot_value)) { $slot_value = [ "#plain_text" => (string) $slot_value, ]; }
But when I put a breakpoint in this if statement, it is not triggered. So I wonder where the plain_text comes.
- Merge request !223Issue #3486380 by grimreaper, pdureau: Fix views table → (Merged) created by Grimreaper
- 🇫🇷France Grimreaper France 🇫🇷
MR ready for discussion.
Impossible to fix otherwise. To avoid the escape from the renderer service, I need to use a formattable (or markup) markup object, and it is not doable in Twig.
-
grimreaper →
committed de01bf0f on 5.1.x
Issue #3486380 by grimreaper, pdureau: Fix views table + Fix Styles...
-
grimreaper →
committed de01bf0f on 5.1.x
Automatically closed - issue fixed for 2 weeks with no activity.