Problem/Motivation

I'm using the module Page Manager to set up a generic page. This module supports me to build a page by using layout builder. I'd like to place blocks that are created from SDC to regions and I run into an error
Drupal\Component\Plugin\Exception\ContextException: The display context is not a valid context. in Drupal\layout_builder\Plugin\SectionStorage\SectionStorageBase->getContextDefinition() (line 150 of /var/www/html/web/core/lib/Drupal/Core/Plugin/ContextAwarePluginTrait.php).

After spending some time digging into the code, I see that when I use layout builder, the blocks I place in the layout is EntityComponentBlock, and these entity blocks require an entity context, which does not exist if I use Layout Builder in Page Manager module. So I think, in my case, instead of placing entity component blocks, I just need to use component blocks, and I came up with a patch :-) Happy to have someone review my patch. Thanks!

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

sea2709 created an issue. See original summary.

sea2709’s picture

I just found out that there was a mistake in my patch. So this is the updated one.

pdureau’s picture

Title: Support using component block on a layout using layout builder without an entity context » [2.0.7] Support using component block on a layout using layout builder without an entity context

Thanks a lot Dang Tran. We will have a look after 2.0.6 release.

pdureau’s picture

Title: [2.0.7] Support using component block on a layout using layout builder without an entity context » [2.0.8] Support using component block on a layout using layout builder without an entity context
pdureau’s picture

Assigned: Unassigned » just_like_good_vibes
Status: Active » Needs review

just_like_good_vibes made their first commit to this issue’s fork.

pdureau’s picture

Status: Needs review » Reviewed & tested by the community

Reviewed by Florent& Pierre.

No ContextException anymore.

Notice: I see an entity context in layout bulder with page manager, probably with the Page entity , but the context seems to be missing when the page is displayed.

just_like_good_vibes’s picture

thanks

just_like_good_vibes’s picture

Assigned: just_like_good_vibes » Unassigned
Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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