When managing default layouts for view mode of an entity type, users must navigate to Admin -> Structure -> Content Types -> [Node Type] -> Manage Display -> Manage Layout.
When managing a layout override for an individual entity, users must simply click the "Layout" tab alongside the existing View/Edit tabs.
In Panelizer world (at least in D7), the action for managing the layout of a page is nearly identical if you're modifying the default layout or an override. The only difference in the UI is that the button is either "Save as Default" or "Save as Override".
Something like this could work I think but is still not great:
1) When viewing an entity that does not have overrides enabled, add a "Layout" tab and link it to the page for managing the layout for the entire view mode.
2) When viewing an entity that does have overrides enabled, have a tabs "Layout - Override" and "Layout - Default"
My use case: I have a "Landing Page" content type that allows overrides (because every node of this type will always have its own unique layout). I also have a "News" content type, that does not allow overrides. I still want site builders to be able to manage the layout for news articles, but I don't want to confuse them by offering two very different ways of accessing the layout page.
With this patch, you'd get a message above the layout builder telling you what you're editing:
Defaults:

Overrides:

Bartik Defaults:

Bartik Overrides:

| Comment | File | Size | Author |
|---|---|---|---|
| #119 | 2988970-message-119-interdiff.txt | 824 bytes | tim.plunkett |
| #119 | 2988970-message-119.patch | 19.22 KB | tim.plunkett |
| #118 | Edit layout for Article content items Umami Food Magazine 2019-03-25.png | 474.13 KB | tim.plunkett |
| #118 | 2988970-message-118-interdiff.txt | 2.94 KB | tim.plunkett |
| #118 | 2988970-message-118.patch | 18.98 KB | tim.plunkett |
Comments
Comment #2
tim.plunkettAssigning to @DyanneNova for input
Comment #3
tim.plunkettComment #4
sugaroverflow commentedreassigning to work on MWDS2018 :D
Comment #5
sugaroverflow commentedComment #6
tedbowIt think it would great if we could solve this is way where it works for bundles that don't have the layout builder enabled.
In general this been problem for a while where it is hard to find what controls the "display" on fieldable entities. If a site has articles using layout builder and basic page using manage display for fields if use has access to both you should be able to easily find the way to effect the display in block cases.
once #2914486: Add granular permissions to the Layout Builder is committed we could easily have user that can only change defaults and not overrides.
Comment #7
sugaroverflow commentedWorked on the first part of this today - moving the code to create local tasks from the Derivative into the SectionStorage classes.
Comment #8
tim.plunkettAfter LOTS of pair programming with @sugaroverflow, we decided to move the (awesome) refactoring above to a new issue.
This new patch skips over that refactor for now.
No interdiff as it is a completely new patch.
The current "Layout" local task takes the user into the flow for overriding the layout for that entity.
This has been relabeled "Customize this page" for now.
The new "Layout" local task will take you to one of two places:
If the entity has no overrides yet, it will take you to the "Manage Layout" page for that entity view display.
If the entity has overrides, it will take you to the Layout Builder for that override.
This is what we came up with at the sprint, but is still rather confusing. More work must be done here to determine what the actual desired flow should be.
Comment #10
sugaroverflow commentedDocker hub was down due to maintenance so the patch failed. We retested and it passed ✌️
Comment #11
tim.plunkettComment #12
tim.plunkettComment #13
tim.plunkettThis need some work from @DyanneNova, not ready for wider review.
Comment #14
aaronmchaleI like the general idea here.
I agree with #6 that maybe first we should look to solve the more generic issue of making it easier to get to the “manage display” (or even manage fields) for any Entity, not just within the context of Layout Builder.
I’m also not a fan of the naming proposed in the original summary, #8 makes some good progress on that but we really need to prioritise the experience of the frontend content editor who will only ever manage the “override layout”, as coming from the perspective of a large organisation many more people will manage overrides than will ever use the Manage Display Layout Builder. The people using the Manage Display Layout Builder experience will typically be more advanced users who understand the difference. So I’d be very hesitant with any terms such as “override” that might make the workflow of content editors more confusing.
Comment #15
aaronmchaleComment #16
aaronmchaleMaybe the ideas in this issue are something to think about.
Comment #17
bkosborneI agree with these points. Override could be confusing to our users as well now that I think about it, since we wouldn't give them permission to modify the default view mode layout anyway.
Comment #18
aaronmchaleAnother related issue, maybe there’s some cross-over here.
Comment #19
tedbowI couldn't figure out this test change at first. But I see that this patch is also changing where the user is redirected when the user reverts the override.
This seem unrelated to the current issue.
Comment #20
tim.plunkettThat change is needed for the new flow of things. However we're not set on the given proposal yet...
Comment #21
tim.plunkettReroll now that #2995071: Refactor LayoutBuilderLocalTaskDeriver to delegate local tasks to plugins went in.
Comment #22
tedbowI think "revert" here in both these lines should actually be "redirect". if this is suppose to use the route that is added in this patch.
Right now this is actually just be overwritten by last assignment to $local_tasks array in this block.
The key
layout_builder.overrides.$entity_type_id.revertis being used twice.Right now there is not test for local task and where it redirects so that is why the tests pass.
Comment #23
tim.plunkettComment #24
tedbowFixed #22
re #8
I think for people having the ability to see both the defaults and the overrides once you go to an existing entity that has an override will be confusing because "Layout" and "Customize this page" this will take them to the same place. But I could see how that might be confusing. and they think it is not the same place and trying to figure out the difference
It seems like for people with both permissions
entity with no override.
Layout -> "[bundle_label] layout]"
entity with override
remove "[bundle_label] layout]" because the bundle level has not effect.
or I guess a page that explains this with the option of revering to defaults.
Comment #26
tedbow\Drupal\Tests\layout_builder\Functional\LayoutDisplayTest::testMultipleViewModes()needed to be updated to use "Customize this page" link. It was only passing because the redirect was wrong.Comment #28
aaronmchaleLeaning towards agreeing with @tedbow in #24 that having the "Layout" local task do different things depending on the context could be very confusing and possibly result the user making changes to a layout where the user thought they were editing the customised layout but were actually editing the bundle layout (and probably vies versa).
Comment #29
tedbow#27 seemed to be drupalci error. Retested and passed
Comment #30
tim.plunkettWhoa, this change makes sense but is kinda worrisome. How were we getting away with this in HEAD?
Also curious how this would look once #2976148: Layout-based entity rendering should delegate to the correct section storage instead of hardcoding to either defaults or overrides lands
Comment #31
tim.plunkettNeeds reroll and or rethinking of approach.
Comment #32
bnjmnmRe #31
I'm going with the "and" option - I'm going to look into alternate approaches and will summarize them here. I also think a working patch will aid that process, so here's a reroll of #26
Comment #33
bnjmnmComment #34
bnjmnmComment #35
bnjmnmI created visualizations that map out some possible approaches, including comments on some of the choices.
I intentionally included options unlikely to be implemented. If it seemed like something that might aid the decision process, I put it in there. I'm particularly interested in which options strike people as being not-at-all feasible, as that can curtail some of the choice paralysis in selecting an approach.
One Layout-related link option:

Two Layout-related links option:

The draw.io files are also attached if there is interest in expanding on what I've already provided. The .txt file extension needs to be changed to .xml to be opened in draw.io as I can't upload an .xml file.
Comment #36
dyannenovaOn the ux call on Jan 22, we discussed a plan for how this can be handled. Here are the mockups that were reviewed, with the updates based on feedback from the call:
Comment #37
tim.plunkettJust to note, implementing this will be blocked by #3004536: Move the Layout Builder UI into an entity form for better integration with other content authoring modules and core features. I am actively working on that issue.
Comment #38
tim.plunkettThe blocker landed.
Here's a rough first attempt on this patch.
One thing we need is the SVGs for those two icons that accompany the message. Leaving assigned to @DyanneNova for that.
Comment #40
dyannenovaI've attached the icon files in a zip because svgs can't be uploaded here.
Comment #41
phenaproximaThanks, @DyanneNova! Unassigning.
Comment #42
phenaproximaStill needs tests and styling, but here is a patch which includes the SVGs as well.
Comment #43
phenaproximaFixed a couple of small bugs and added a couple of test assertions.
However, I don't know how to approach the styling for this; will need to discuss with @DyanneNova.
Comment #44
tim.plunkettUse
'#type' => 'container'ands/'#value'/'message'Comment #46
phenaproximaAdded some styling after quick discussion with @DyanneNova. Screenshots attached of how it looks in Bartik.
One thing I noticed is that, with the RTL styles, the period in the sentence comes at the left, not the right. That seems really weird, but I guess it's expected in RTL displays? I'm not sure. Anyway, let the screenshots be your guide...
Comment #47
phenaproximaForgot to set it to NR!
Comment #48
phenaproximaOh, and I also forgot the interdiff.
Comment #49
phenaproximaThis one fully addresses @tim.plunkett's feedback in #44. (Patch #46 only partially addresses it.)
Comment #52
tim.plunkettNit: These don't actually need to be private, might as well switch it back to protected :\
These look correct. Yay BEM, I guess!
No real substantive feedback, but then again, I wrote the original version.
Assigning to Emilie to weigh in on the CSS and any other styling tweaks that might be needed.
Also making sure those of us who discussed at MWDS get credit for their input.
Comment #53
phenaproximaChanged the methods to protected.
Comment #54
phenaproximaAdded a missing </a>.
Comment #57
phenaproximaOn @bnjmnm's advice, I tried adding layout_builder_test_css_transitions to the modules enabled for TestMultiWidthLayoutTest. Let's see if that helps.
Comment #58
tim.plunkettComment #59
dyannenovaThe lighter green of the icon will be more discernible with a lighter yellow, there isn't enough contrast right now. Here's a color value that will work better: #f7efcf
Comment #60
phenaproximaFixed. Adding screenshots to the IS too.
Comment #61
tim.plunkettFor the record, the new value is equivalent to
rgb(247, 239, 207). Not sure if you wanted to keep it that way.Comment #62
dyannenovaThis looks good to me!
Comment #63
tim.plunkettI didn't realize that this would become only the 3rd usage of rgb() in core, let's switch this one to hex too.
#b4a02e, looks like?Comment #64
phenaproximaFixed!
Comment #65
tim.plunkettThanks!
Comment #67
phenaproximaUnrelated (known random) test failure in Media Library.
Comment #68
xjmAre all the UX meeting contributors credited here as well?
Comment #71
webchickThey are now! Crediting from UX 1/22 meeting: https://www.youtube.com/watch?v=QbrxHvjQOCU
Comment #72
larowlanany reason not to use '#theme' => 'messages' here so it looks consistent with any front-end theme?
should we be checking they have access to edit the default before showing the link?
what is this change for? nevermind saw #57
Comment #73
lauriiiI was reviewing this and I found out #72.1 as well. The current styles are also specific to Umami and don't look great in Bartik for example.
Comment #74
tim.plunkett#72.2
Without #2914486: Add granular permissions to the Layout Builder, any user that can see this message has permissions to edit the defaults. However, until #3003610: Remove block.module dependency from Layout Builder is resolved, the user also needs to have permission to manage the entity view display.
@phenaproxima suggested in chat that we check access to the URL directly, instead of permission checks, in order to future-proof
Comment #76
phenaproximaLet's see how the URL access check works. I'm not sure why the interdiff shows CSS changes; maybe I moved stuff around. Whatevs!
Comment #78
phenaproximaThis should fix the tests. Looks like the data provider pattern will not work properly in this case, so I just added a new test method to LayoutBuilderTest.
Comment #79
tim.plunkettAFAIK this does not work.
The string needs to be within the t() for the parsing.
I'd suggest making a local variable for the args, and then doing the t() directly in the if/else.
Also you can add
:linkto the $args in the if, since it's not needed in the else.These assertion seems superfluous to me. We need to be able to assume this works here, IMO. Just create and save it all at once
Are we sure this is necessary? Can we try it without?
Can you post a FAIL patch as well with the next iteration? Thanks!
Comment #80
phenaproximaAll fixed!
Comment #81
phenaproximaSorry, forgot the interdiff!
Comment #84
phenaproxima@bnjmnm explained the test failure to me. To quote him (and I added this comment in the test):
So that's why I'm changing LayoutBuilderDisableInteractionsTest in this patch.
Comment #86
dyannenovaI discussed the styling issue from #72 and #73 with lauriii and we agreed that the current approach is fine. This message should not inherit theme styling for current messages because themes frequently use their own icons to represent message status. In our case we are using the icons as a visual affordance for the user to more easily distinguish between the default and the override. The current styling isn't using Umami colors, it's intended for any of the core themes, and hopefully will work well enough generically for other themes.
Comment #87
tim.plunkettGreat, thanks everyone! Looking forward to getting this one in
Comment #88
lauriiiIt seems like the current colors don't have sufficient contrast to meet our accessibility core gates. Umami default link color with the current background doesn't fulfill WCAG AA. Bartik default link color with the current background color fulfills WCAG AA, but the color used for :hover doesn't fulfill WCAG AA.
I'm also wondering if we should add a hidden title describing that the element is an info message like we have on status messages. Adding the the accessibility tag since we are adding a new status message like element.
Comment #89
lauriiiThank you @andrewmacpherson for pointing out in Slack that in WCAG 2.1, the contrast should be applied not only to the text but to all non-text elements (reference). Therefore since we are going to have to make some changes anyway, we might want to increase the contrast between the border and the background, as well as between the icon and the background.
Comment #90
andrewmacpherson commented@lauriii asked in Slack if I would look at this..
Can you clarify:
Edit: also, by title, do you mean heading?
Comment #91
lauriii@andrewmacpherson
I hope this provides more context to my request:
Comment #92
xjmAnother missing CSS newline. :)
Comment #93
lauriii#92: According to our CSS formatting guidelines, by default, we are not supposed to add newlines between CSS rules. In this case, these selectors are related to each other since they are modifying the same element. Instead of adding newline between these rules, we probably should remove the newlines between all the other selectors we are adding as well.
Comment #94
xjmYeah I'm wrong about #92; disregard.
Comment #95
lauriiiTo get sufficient contrast, we would have to change the background color roughly to #fbf8e9, the border color to #7a6c1f and the icon color #4d7b37. We could consider standardizing the link styles inside the message rather than relying on custom styles. If we want to rely on custom styles, maybe it would be safest for us to use a very light background instead.
Comment #96
dyannenova#05840B for the icon and link on a #fffae7 background has enough contrast if we agree to standardize the link colors for this message (which I do think would be better overall). The border shouldn't need higher contrast because it isn't an affordance, just a design element.
Comment #97
lauriiiThank you @DyanneNova! Before we can start implementing this, we still need colors/designs for hover, focus, and active states.
Comment #98
dyannenovaLet's use underline for hover and focus states. We can use #0476CA for the active state, which has appropriate contrast against the background and is clearly distinguishable from the green.
Comment #99
lauriiiImplemented the color changes and it looks following:
Comment #100
tedbowJust a reroll. I think there were some uneeded changes in LayoutBuilderDisableInteractionsTest. That file changes recently. That test still passes.
I check to make the messages show up. they look good.
Comment #101
xjmCan we get Bartik screenshots as well?
Comment #102
bnjmnmThe message for User layouts is kind of strange "You are editing the layout for this User user" . Perhaps if the bundle and singular label match, then only one needs to be shown?
Will continue reviewing, but thought this may be something someone wants to work on without waiting for the whole review.
Comment #103
balsamaAdded Bartik screenshots to IS.
Comment #104
tim.plunkett#102
I agree 100%. We did this for permissions too, by checking
$entity_type->hasKey('bundle')#103
Thanks!
Comment #105
balsamaRealized I was mixing plural and singular strings without aa pattern. nvmd.
+1 to #102, but still a little awkward when the bundle contains the entity type, like "Default comments". What if we just ditched the entity label altogether?Comment #106
tim.plunkettImplemented #102, with test coverage
Comment #107
bnjmnmReviewed the code and I can RTBC this once the CSS from @lauriii gets +1'd
Comment #108
dyannenova+1 to the CSS changes.
Comment #109
bnjmnmComment #110
lauriiiThe key point of the accessibility review was the colors and they have been fixed so I don't think we should expect any further input from the accessibility team on this.
+1 for RTBC, looks all good 🧚♂️✨
Comment #111
webchickSpent some time reviewing this with @xjm. Our initial impression is that the extra message styling here looks (to a layperson) as a mistakenly styled standard warning message. Here's a screenshot with both, for comparison. You can see that the default message is using a sans-serif font, different yellow, etc. The Layout Builder message kinda looks like it's coming from Umami. (I realize it's not, and the colours were actually carefully chosen to be WCAG compliant when including the link.)
@DyanneNova and @tim.plunkett explained the rationale for this, which is:
TL;DR, we need that warning to look like a standard Bartik/Seven message w/ a different icon (this is what the UX team signed off on). Colours are negotiable, and happy to defer that decision to @DyanneNova's "design eye."
Comment #112
tim.plunkettNot yet addressing #111, but this fixes a constructor change that xjm requested.
Leaving NW.
Comment #113
webchickFor reference: #375928: Add type "info" to Drupal Messenger service (Wow, 6-digit node iD!)
Comment #114
tim.plunkett#111
1) Thankfully we can use
#theme => status_messagesdirectly (as opposed to the messenger service itself or even#type => status_messages, this sidesteps this problem2) Agreed on not using warning. Plus, there is an aria-label for that which literally says "Warning" and we definitely don't want it.
This attempts to address #111 in the least controversial way: By using the status message rendering but with our own icons (#111.3)
This allows room for future improvement with more targeted CSS (#111.5) as well as potentially switching from
statustoinfoif #375928: Add type "info" to Drupal Messenger service lands (#111.4)Comment #115
webchickThe screenshots in #114 look great to me, FWIW.
Comment #116
lauriiiLooks good in Bartik. Let's make this work in Umami as well. ✌️
Comment #117
tim.plunkettClassy (and therefore every other stable core theme) uses
.messagesfor the background image.Specifically in this case
.messages--statusUmami uses
.messages--status .messages__contentThat's a bug in Umami, no?
Comment #118
tim.plunkettAdded a workaround to fix #116 for now, #3043228: Add Umami-specific styling for Layout Builder messages can fix it correctly once LB is stable.
Comment #119
tim.plunkettNope, wrong patch and wrong interdiff. NOW its right
Comment #120
dyannenovaThis looks good to me. I think this is ready to go!
Comment #121
lauriii+1 to RTBC. I think it's reasonable to move fixing the Umami design to time after layout builder has been marked stable because there isn't any good way to fix it prior to that.
Comment #124
webchickGreat! I ran into the lack of this bug while testing the Quick Edit one, so nice to see this one land.
This meets the UX team requirements for the message, gets rid of the inconsistent styling noted in #111, and also fixes the blatant hilarity in #116. :D
Committed and pushed to 8.8.x, cherry-picked to 8.7.x. Thanks, all!
Comment #126
maskedjellybeanIs it possible to disable this message? I could hide it with CSS but if there is a legit way via some GUI setting that would be preferred.
I'd also like to point out that the message is a bit unclear. Currently it says (Layout Page is the name of my content type):
"You are editing the layout for this Layout Page content item. Edit the template for all Layout Page content items instead."
I think it should say:
"You are editing the layout for this Layout Page content item. Edit the default layout for new Layout Page content items instead."
This is more clear about what effect modifying the default layout will have on existing content. Which is nothing. But you wouldn't know that until you try it, which can be scary when you already have layouts configured for many nodes. I realize this ticket is closed so I may open another ticket for this.
Comment #127
bnjmnmThis isn't correct, modifying the default layout will impact all existing content that is not overriding that layout, and this is a use case covered in automated tests. If this is not what you're experiencing, that would warrant an issue, and the issue can be best addressed if it includes steps of how to reproduce what you're encountering on a fresh Drupal install.