Problem/Motivation
Steps to reproduce:
Install Layout Builder module
Manage Display of one content type, like "Basic Page". Under "Custom Display Settings", enable Full view mode
Manage Display of a different content type, like "Article".
Expected
Overrides can be enabled for Articles
Actual
No checkbox present, overrides cannot be enabled
Proposed resolution
Limit the query to the specific entity type and bundle.
Remaining tasks
Write tests
User interface changes
N/A
API changes
N/A
Data model changes
N/A
Release notes snippet
N/A
Original report
I've been building a mega menu in my dev environment based on this tutorial . I updated that environment to 8.7 and everything I was working on broke due to the disappearance of the ability to customize layouts of individual menu items.
How to Reproduce
- Update to 8.7
- Install Layout Builder, Menu Item Extras
- Go to /admin/structure/menu/my_menu/display to view location of missing settings
Expected Behavior
The second checkbox to allow menu items to have custom layouts should still be available.
What Happens Instead
The second checkbox is missing. Features that depend on this setting break. I can no longer manage layouts on individual menu items.
| Comment | File | Size | Author |
|---|---|---|---|
| #9 | 3053529-canonical-9-PASS.patch | 2.49 KB | tim.plunkett |
| #9 | 3053529-canonical-9-FAIL.patch | 1.61 KB | tim.plunkett |
| #5 | 3053529-canonical-5.patch | 907 bytes | tim.plunkett |
Comments
Comment #2
jpieper commentedComment #3
tim.plunkettHmm, I'm having trouble reproducing the bug. After installing Menu Item Extras and Layout Builder, I see both checkboxes on
admin/structure/menu/manage/my-menu/displayand can customize the layout of individual menu items.Comment #4
jpieper commented@tim.plunkett I installed a fresh site locally and was able to get this to work without issue just as you described.
I went back to the site with which I'm having issues to see wha's going on. I checked inthe LayoutBuilderEntityViewDisplayForm.php file and verified my menu's mode via
$this->entity->getMode(). It returns "default". However,$this->isCanonicalMode($this->entity->getMode())is returning false.I looked further into
isCanonicalMode(), specifically the following query:This query is returning the 'full' view mode of an unrelated content type:
This doesn't seem to be correct but I'm not sure what might be causing this.
Comment #5
tim.plunkettOh, wow. I was able to reproduce.
The problem occurs if you have the full view mode enabled for any other bundle on the site. Because the query is not nearly specific enough.
Comment #6
jpieper commentedI applied the patch in #5 and it resolves the issue with menu links. The option to allow each entity of the given type to have its layout customized now shows up as expected. When that option is checked I've verified that the "Layout" tab is available, too.
I noticed while testing that this issue was occurring in various content types in addition to the menu link issues. It's working as expected for those content types as well.
Comment #7
jpieper commentedComment #8
tim.plunkettThanks for the review! I'm glad to hear it works.
Before it can be committed, it needs automated tests. Working on that.
Comment #9
tim.plunkettComment #10
portulacaI'm also affected by this, although I'm not using the Menu Item Extras, and I *don't* have the
Full contentenabled on any Content type.Where else should I check where the
Full contentmight be enabled?I only use Layout Builder on Articles.
Anyway, I applied the patch from #5, and everything seems to be working now.
I see the option Allow each content item to have its layout customized., I can enable it, I can override Layout for individual nodes of type where LB is enabled, and I can see the Layout tab on those nodes.
Comment #12
tim.plunkettIt will fail if "Full" is on for *any* entity type, because I was horribly sloppy when writing the original query :(
Anyway, this should be good to go now
Comment #13
phenaproximaNice catch + fix.
Comment #14
xjmPromoting to major given the number of reports here. Thanks!
Comment #17
xjmCommitted and pushed to 8.8.x and cherry-picked to 8.7.x. Thanks!