Using the ui_patterns view style can error out when there is a single result row

Created on 13 May 2025, 1 day ago

Problem/Motivation

When you configure a view to use a pattern as view style, and map the 'View rows' to a slot. You can get an error like

Exception: Object of type Drupal\commerce_product\Entity\Product cannot be printed. in Drupal\Core\Template\TwigExtension->escapeFilter() (line 459 of core/lib/Drupal/Core/Template/TwigExtension.php).

I found that function isSingletonRenderArray wrongfully removes the array surrounding the single views result row.

In our pattern, we loop over the slot to which the 'View rows' are mapped, resulting in the mentioned error.

Steps to reproduce

  1. Configure a view and use a pattern as view style
  2. Map the 'View rows' to a slot
  3. Add a filter that gives you a single result
  4. Go the view and use the filter

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Active

Version

2.0

Component

Code

Created by

🇧🇪Belgium stefdewa

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024