Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

erikerskine
Copy link

What does this change?

Does not render regions in localgov_base_preprocess_page() when determining things like has_sidebars.

A region is now considered non-empty if it one or more blocks are placed within it (and those blocks are configured to be visible).
We do not consider what those blocks will actually output (if anything).
If a block is placed but produces no output, its region is still considered to be non-empty.

This is closer to Drupal's core behaviour and is necessary for placeholdering and BigPipe to work properly.

See #597 for discussion

How to test

  1. Add a block that produces no content. (This can be a custom block plugin, a view, anything)
  2. Place that in a sidebar. Make sure it is the only thing in the sidebar.
  3. The page should render with a sidebar.

How can we measure success?

An otherwise cacheable page with an uncacheable block in a sidebar will now be cacheable.

Have we considered potential risks?

Sites which rely on this to hide sidebars when blocks do not produce content may find that those sidebars now appear.

That can be mitigated against, with:

  • visibility conditions on the block configuration page
  • using CSS :has to detect emptiness on the client side
  • a contrib module to force blocks to render ahead of time

Accessibility

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant