Problem/Motivation
Navigating to Manage Layout for a content type display yields the exception:
Drupal\Component\Plugin\Exception\ContextException: The entity context is not a valid context. in Drupal\layout_builder\Plugin\SectionStorage\SectionStorageBase->getContextDefinition() (line 184 of /var/www/docroot/core/lib/Drupal/Core/Plugin/ContextAwarePluginTrait.php).
This is because there is no entity context for a display. The code assumes you are managing the layout for an individual content node.
Steps to reproduce
Navigate to a content type view display that is Layout Builder enabled and click Manage Layout.
Example URL: /admin/structure/types/manage/{content_type_name}/display/default/layout
Proposed resolution
Check if the context is valid.
Remaining tasks
User interface changes
API changes
Data model changes
| Comment | File | Size | Author |
|---|---|---|---|
| #7 | not_valid_context-3392780-reroll_patch_from_4-7.patch | 4.27 KB | mauhg |
| #4 | layout_builder_perms-3392780-4.patch | 4.35 KB | john.oltman |
Issue fork layout_builder_perms-3392780
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
Comment #2
john.oltman commentedComment #3
john.oltman commentedComment #4
john.oltman commentedThis version catches a few different errors.
Comment #6
viren18febs commentedI have added a patch with dependency injection for event dispatcher, please review.
Comment #7
mauhg commentedReroll from patch #4, since it was not applying correctly for me.
Reroll from module's dev version
Comment #8
rajab natshahFacing the same issue when editing the layout for the default layout in the content type, taxonomies, block type, mini layouts, and other entities.
Comment #9
rajab natshahComment #10
rajab natshahComment #11
rajab natshahThank you, Mauricio
The #7 patch is working
Comment #15
sdstyles commentedThanks all for fixing it!