Problem/Motivation

Drupal\Core\Render\Component\Exception\InvalidComponentDataException: Unable to render component "ui_suite_bootstrap:grid_row_1". A render array or a scalar is expected for the slot "col_1_content" when using the render element with the "#slots" property in Drupal\Core\Render\Element\ComponentElement->generateComponentTemplate() (line 118 of core/lib/Drupal/Core/Render/Element/ComponentElement.php).
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.

just_like_good_vibes’s picture

Status: Active » Postponed (maintainer needs more info)

please add more details to the usecase, not very clear how to reproduce :)

just_like_good_vibes’s picture

Assigned: Unassigned » grimreaper
grimreaper’s picture

Status: Postponed (maintainer needs more info) » Active

- Install the standard installation profile
- use a UI Suite theme, like ui_suite_bootstrap (5.1.x)
- in manage display of the article content type, enable Layout Builder on the view mode full
- in Layout Builder add a section from a component, like grid_row_1
- in this section, place the "block" to display the comments field
- keep default settings of the comment field formatter
- save
- error on display

grimreaper’s picture

Assigned: grimreaper » Unassigned
pdureau’s picture

Title: Not possible to display a comment field in Layout Builder » [2.0.0-rc2] Not possible to display a comment field in Layout Builder
Assigned: Unassigned » just_like_good_vibes
just_like_good_vibes’s picture

This is an horrible SDC bug...
there is a complex render array generated by the comments block, without any comments.

At a certain depth in the render array, there an an empty array as the value of key "comments".
empty arrays are not considered render arrays, and the whole array structure is then considered not being a render array,
and SDC fails with WSOD.

i propose to create a workaround for that case in ui_patterns, but that's clearly not our role.
We will help users, to keep protected from SDC being too strict :(

just_like_good_vibes’s picture

or maybe just a core bug...
see Drupal\Core\Render\Element::isRenderArray called from ComponentElement::generateComponentTemplate, line 112. the line Element::isRenderArray($slot_value) is generating the error.

just_like_good_vibes’s picture

Assigned: just_like_good_vibes » grimreaper
Status: Active » Needs review

here we go :) normalization of slot, a new add-on. Stronger than before :D

grimreaper’s picture

Thanks, it works now!

just_like_good_vibes’s picture

coool :)

just_like_good_vibes’s picture

Assigned: just_like_good_vibes » Unassigned
Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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