Problem/Motivation

With the Component views style, "Force using fields" checked and the "[View] Rows" source in a slot, a view with one result gives the slot the fields of that row instead of a list with one row. A template that loops on the slot then loops on the fields.

Steps to reproduce

  1. Create a view with the Component style and check "Force using fields".
  2. Pick a component whose template loops on a slot, and put the "[View] Rows" source in that slot.
  3. Filter the view so it returns one result.

Proposed resolution

The component builder unwraps single-item arrays at every level, so it also removes the extra level the views source adds for a single row. We could unwrap one level only, then remove empty arrays as it does today.
Add a kernel test for a view with one row, and one for the comment form in a slot.

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

just_like_good_vibes created an issue. See original summary.

just_like_good_vibes’s picture

Assigned: just_like_good_vibes » Unassigned
Status: Active » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

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