Context is missing when section is transformed into renderable array causing context mapping to fail

Created on 19 July 2023, over 1 year ago
Updated 30 April 2024, 7 months ago

Problem/Motivation

When a block with a context definition requirement is placed in the layout the /layout page works well and uses context mapping to determine the correct context (or shows a placeholder) but the dashboard canonical page or preview page fails with WSOD

Drupal\Component\Plugin\Exception\ContextException: The 'entity:user' context is required and not present. in Drupal\Core\Plugin\Context\Context->getContextValue() (line 73 of core/lib/Drupal/Core/Plugin/Context/Context.php).

Steps to reproduce

  • Create a dashboard
  • Add any section
  • Add block - User fields: Member For
  • Save and go to Dashboard view

Proposed resolution

Pass contexts, including runtime contexts, when rendering a section in DashboardController::build().

LayoutBuilderContextTrait::getPopulatedContexts() is used when context gets populated in the layout builder editor.

🐛 Bug report
Status

Fixed

Version

2.0

Component

Code

Created by

🇳🇴Norway zaporylie

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024