Problem/Motivation
The section storage parameter converter in Layout Builder returns NULL for the layout_builder.overrides.ENTITY_TYPE_ID.view route where the associated entity doesn't have Layout Builder enabled (or doesn't allow layout overrides), causing the page to not be cacheable.
Steps to reproduce
Install Layout Builder, but don't enable it for any entity types. Ensure menu local tasks appear on all pages. Navigate to a sample entity and observe that full-page caching is impeded with a max age of 0 seconds from the "Layout" local task's forbidden access result caused by ParamNotConvertedException.
Proposed resolution
- Modify
OverridesSectionStorage::extractEntityFromRoute()to remove the validation on the extracted entity. (This will causeOverridesSectionStorage::deriveContextsFromRoute()to return the appropriate context values.) - Modify
LayoutTempstoreParamConverter::convert()to run context validation before returning the section storage. - Augment
LayoutTempstoreParamConverter::convert()to return the entity's default section storage plugin as a fallback. This will cause a section storage type mismatch that can be detected inLayoutBuilderAccessCheck::access(). - Augment
LayoutBuilderAccessCheck::access()to exit early with a forbidden access result if a section storage type mismatch is detected (cached until the applicable entity display is updated).
Remaining tasks
- Observe no failures in existing test cases in Drupal CI (or address failures as needed)
- Write tests to cover the changes in this issue
- Subsystem maintainer review
- Add release notes snippet (should one be required)
User interface changes
n/a
API changes
n/a
Data model changes
n/a
Release notes snippet
To be posted pending additional review.
Issue fork drupal-3219656
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:
- 3219656-section-storage-parameter
changes, plain diff MR !816
Comments
Comment #3
clayfreemanComment #4
tim.plunkettAt first glance the issue title reminded me of #3190542: Layout Builder overrides section storage sets local tasks block cache max-age to 0 on content entity pages without overrides enabled. Still might be related, but less sure after looking at the MR.
Comment #6
clayfreeman@tim.plunkett I agree that this is a duplicate. Closing as such.