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

  1. Modify OverridesSectionStorage::extractEntityFromRoute() to remove the validation on the extracted entity. (This will cause OverridesSectionStorage::deriveContextsFromRoute() to return the appropriate context values.)
  2. Modify LayoutTempstoreParamConverter::convert() to run context validation before returning the section storage.
  3. 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 in LayoutBuilderAccessCheck::access().
  4. 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

  1. Observe no failures in existing test cases in Drupal CI (or address failures as needed)
  2. Write tests to cover the changes in this issue
  3. Subsystem maintainer review
  4. 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

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

clayfreeman created an issue. See original summary.

clayfreeman’s picture

Assigned: clayfreeman » Unassigned
Status: Active » Needs review
tim.plunkett’s picture

At 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.

clayfreeman’s picture

@tim.plunkett I agree that this is a duplicate. Closing as such.