Problem/Motivation

With UIP2, Views table are broken.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

grimreaper created an issue. See original summary.

grimreaper’s picture

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.

grimreaper’s picture

Assigned: grimreaper » pdureau
Status: Active » Needs review

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’s picture

Title: Fix views table » Fix views table + Fix Styles library + Remove deprecated code now that minimum version is 10.3
Assigned: pdureau » Unassigned
Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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