ViewsBlock::isRenderedInCurrentRequest() returns false negative when the block view is placed through layout builder

Created on 3 August 2021, over 3 years ago
Updated 25 February 2023, almost 2 years ago

Problem/Motivation

While developing a site, and trying to setup breadcrumbs for facets, we found this issue.
\Drupal\search_api\Plugin\search_api\display\ViewsBlock::isRenderedInCurrentRequest() relies on the existing block config entities, but those didn't exist when a block is placed using layout builder.
Therefore, it should be a mechanism to detect if the block is placed using layout builder in the current page, with fallback to the existing detection mechanism if not.

Steps to reproduce

  • Create a search api block view an a facet
  • Place the block and the facet into a content entity using layout builder
  • Setup the breadcrumb for facets
  • The breadcrumb won't work

Proposed resolution

Add support for layout builder to the isRenderedInCurrentRequest() method (if the module is installed).
Fallback to the existing detection method if the module is not installed or the block component was not detected in the current page.

Remaining tasks

  • Patch
  • Review
  • Test
🐛 Bug report
Status

Fixed

Version

1.0

Component

Facets

Created by

🇪🇸Spain akalam

Live updates comments and jobs are added and updated live.
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.

Production build 0.71.5 2024