Problem/Motivation

This is partial a bug report and also just asking what Core Context is used for.

I am trying to set up Layout Library and all was going well until trying to edit a layout and when trying to add a block, i get this error:

TypeError: Argument 1 passed to Drupal\core_context\EventSubscriber\SectionComponentRenderArray::getContextsFromSectionStorage() must implement interface Drupal\layout_builder\SectionStorageInterface, null given, called in E:\www\myssc\html\modules\contrib\core_context\src\EventSubscriber\SectionComponentRenderArray.php on line 89 in Drupal\core_context\EventSubscriber\SectionComponentRenderArray->getContextsFromSectionStorage() (line 112 of E:\www\myssc\html\modules\contrib\core_context\src\EventSubscriber\SectionComponentRenderArray.php)

This seems to have been reported in various forms over the past couple years and marked as fixed.

I see Mike Gifford reported it here: #3114416: Layout builder new layout for new content type, add body block to section gives ajax error where Will suggested this was fixed here: #3120388: EntityRouteProvider breaks default layouts. This fixed issue: #3116257: Fatal error when trying to edit entity-specific layout in Layout Builder (Argument 1 passed to SectionComponentRenderArray::getContextsFromSectionStorage() must implement interface SectionStorageInterface, null given) also seems to be related. Yet, the problem persists.

Disabling Core Context seems to be tied to a lot of WxT modules (which were mostly uninstalled when i disabled layout_builder_restrictions): layout_builder_restrictions, lightning_layout, lightning_landing_page, wxt_ext_layout, wxt_ext_landing_page, wxt_ext_page, wxt_ext_queue, wxt_ext_sitemap. Went ahead and disabled anyway and this fixes the issue.

A quick (very quick) run through of the site (yes, automated regression testing would be awesome) and nothing seems to be broken. So not sure what exactly the Core Context is needed for.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Comments

liquidcms created an issue. See original summary.

liquidcms’s picture

Tried this on a fresh-ish install of D9.2.11 and Layout Library works fine until enabling Core Context; then same issue. I reported it here: #3263703: Core Context breaks Layout Library.

joseph.olstad’s picture

Thanks so much for the followup and insight into the issue, it would be great to get this layout builder issue resolved permanently.

joseph.olstad’s picture

joseph.olstad’s picture

joseph.olstad’s picture

to prove the patch is needed, simply visit this path:

/admin/structure/layouts

TO fix it, apply the patch

liquidcms’s picture

Thanks Joseph. Any idea what CC is used for in WxT (as it doesn't seem to be needed in my install)?

joseph.olstad’s picture

not sure what it's used for .

it was enabled and crashes without the patch.

/admin/structure/layouts

sylus’s picture

Status: Needs review » Fixed

I took your patch @joseph.olstad, core_context is only needed from some legacy layout builder layouts so hopefully this fixes the problem :)

  • sylus committed d9ca276 on 4.2.x authored by joseph.olstad
    Issue #3263697 by joseph.olstad: Core context breaks Layout Library
    

Status: Fixed » Closed (fixed)

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

joseph.olstad’s picture

 @sylus, thanks for the author credit on this commit :)