Problem/Motivation

Most of the layout plugins used with the newly introduced (beta2) LayoutSource plugin are OK:

  • the ones from Layout Builder (ex: layout__twocol_section) are OK
  • most of the ones from Layout Discovery (ex: layout_twocol_bricks) are OK

But layout__onecol don't render regions with nested list of arrays. I don't know why, the twig looks OK, where the full region is printed without checking the inner structure:

        <div {{ region_attributes[region].addClass('layout__region', 'layout__region--' ~ region|clean_class) }}>
          {{ content[region] }}
        </div>

Maybe an alteration somewhere.

Proposed resolution

  • Flat the source list in layout regions for all layouts.
  • Add some unit or kernel tests
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

pdureau created an issue. See original summary.

pdureau’s picture

Component: Main / Misc. » display_builder_page_layout
Status: Active » Needs work

WIP

pdureau’s picture

Assigned: pdureau » Unassigned
Status: Needs work » Needs review

3 changes has been made:

  • the "Some layout plugins don't render regions with nested list of arrays." fix in src/Plugin/UiPatterns/Source/LayoutSource.php
  • An update of SourceWithSlotsInterface::setSlotValue()
  • the addition of a (still minimalist) kernel test for source plugins which has shown a flaw in SourceWithSlotsInterface::setSlotValue(), so it was fixed everywhere it is used.

I would be pleased to discuss with a reviewer about this nested list of arrays issue. I am not conformable the issue has been fixed without being understood. What is the real root cause here?

grimreaper’s picture

The problem comes from the comment field.

pdureau’s picture

The problem comes from the comment field.

Indeed. An empty render array in a layout region is enough to cancel the rendering of the full layout plugins, so let's remove them from the renderable.

The initial investigation was wrong:

  • This is not specific to some plugins
  • This is not related to nested lists

I will create an issue about the empty comment field, which is the reason we were initially confused. It is a totally distinct issue.

pdureau’s picture

Title: Some layout plugins are not rendered properly » Empty renderables in regions prevent layouts rendering
grimreaper’s picture

Status: Needs review » Reviewed & tested by the community

Good for me!

pdureau’s picture

Assigned: Unassigned » mogtofu33

mogtofu33 made their first commit to this issue’s fork.

mogtofu33’s picture

Assigned: mogtofu33 » Unassigned
Status: Reviewed & tested by the community » 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.

  • mogtofu33 committed 2d5fd375 on 1.0.x authored by pdureau
    fix: #3573805 Empty renderables in regions prevent layouts rendering
    
    By...

Status: Fixed » Closed (fixed)

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