Empty layout sections get rendered

Created on 2 July 2019, almost 5 years ago
Updated 5 January 2024, 6 months ago

Problem/Motivation

Empty sections create unnecessary markup. Also, if you've styled the sections with a background/padding you'll get some unwanted bars.

Proposed resolution

Remove empty sections while preserving their cache metadata.

Remaining tasks

User interface changes

N/A

API changes

N/A

Data model changes

N/A

Release notes snippet

πŸ› Bug report
Status

Needs work

Version

11.0 πŸ”₯

Component
Layout builderΒ  β†’

Last updated about 2 hours ago

Created by

πŸ‡©πŸ‡ͺGermany Corn696 Flensburg

Live updates comments and jobs are added and updated live.
  • Blocks-Layouts

    Blocks and Layouts Initiative. See the #2811175 Add layouts to Drupal issue.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ͺπŸ‡ΈSpain iiRealXz

    Adding a patch for the 10.1.x branch.

  • Status changed to Needs review over 1 year ago
  • πŸ‡ΊπŸ‡ΈUnited States tim.plunkett Philadelphia

    Fixed a couple more tests

  • Status changed to Needs work over 1 year ago
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Thank you for this! See this often with clients who aren’t great with layout builder.

    Still seem to be some test failures however. Definitely keeping this on the radar

  • Status changed to Needs review about 1 year ago
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    @tim.plunkett added a condition so the sections do build in layout builder side.

    Thoughts?

  • Status changed to Needs work about 1 year ago
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Thanks. Also seemed to cause some additional test failures that I'll look at.

  • Status changed to Needs review about 1 year ago
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    So this additional checks seems to be the best way to cover all scenarios.

    When adding a section _layout_builder isn't there.

    Tried _admin_route but that caused test failures also.

  • Assigned to tim.plunkett
  • πŸ‡ΊπŸ‡ΈUnited States tim.plunkett Philadelphia

    Fixing merge (using rebase) to allow me to review better

  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    @tim.plunkett wonder if you had a chance to review?

  • πŸ‡ΊπŸ‡ΈUnited States tim.plunkett Philadelphia

    I'll have to re-review, the change to checking for `layout_builder_tempstore` is tricky

  • Status changed to Needs work about 1 year ago
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Tried this out on a local project and I use drush search-api-index

    But I get this error

    > [error] Error while trying to render item entity:node/48:en with view mode full for search index tetra_tech: Call to a member function getOption() on null in Drupal\Core\Layout\LayoutDefault->build() (line 70 of /var/www/html/webroot/core/lib/Drupal/Core/Layout/LayoutDefault.php).

    So seems all scenarios aren't caught.

  • πŸ‡ͺπŸ‡¨Ecuador LeonelEnriquez98

    Adding a patch for the 10.2.x branch

Production build 0.69.0 2024