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 Defaults

Bartik Overrides:
Bartik Overrides

CommentFileSizeAuthor
#119 2988970-message-119-interdiff.txt824 bytestim.plunkett
#119 2988970-message-119.patch19.22 KBtim.plunkett
#118 Edit layout for Article content items Umami Food Magazine 2019-03-25.png474.13 KBtim.plunkett
#118 2988970-message-118-interdiff.txt2.94 KBtim.plunkett
#118 2988970-message-118.patch18.98 KBtim.plunkett
#116 Screen Shot 2019-03-25 at 22.59.01.png26.58 KBlauriii
#114 Edit layout for asdfqwe Drupal 2019-03-23.png242.3 KBtim.plunkett
#114 Edit layout for Article content items Drupal 2019-03-23.png240.17 KBtim.plunkett
#114 2988970-message-114-interdiff.txt2.77 KBtim.plunkett
#114 2988970-message-114.patch18.98 KBtim.plunkett
#112 2988970-message-112-interdiff.txt1.23 KBtim.plunkett
#112 2988970-message-112.patch19.34 KBtim.plunkett
#111 Screen Shot 2019-03-22 at 11.31.28 AM.png411.33 KBwebchick
#106 2988970-message-106-interdiff.txt4.86 KBtim.plunkett
#106 2988970-message-106.patch19.05 KBtim.plunkett
#103 bartik-overrides.png207.62 KBbalsama
#103 bartik-defaults.png216.35 KBbalsama
#102 OverridenUsers.png51.53 KBbnjmnm
#102 AllUsers.png39.99 KBbnjmnm
#100 2988970-100.patch16.92 KBtedbow
#99 Screen Shot 2019-03-22 at 00.04.25.png39.65 KBlauriii
#99 interdiff.txt1.1 KBlauriii
#99 2988970-99.patch18.93 KBlauriii
#96 Banners_and_Alerts_and_d8-8_7-stable-1.png16.55 KBdyannenova
#95 Screen Shot 2019-03-21 at 21.06.22.png33.74 KBlauriii
#84 interdiff-2988970-80-84.txt1.79 KBphenaproxima
#84 2988970-84.patch18.63 KBphenaproxima
#81 interdiff-2988970-78-80.txt2.92 KBphenaproxima
#80 2988970-80.patch16.62 KBphenaproxima
#80 2988970-80-FAIL.patch3.41 KBphenaproxima
#78 interdiff-2988970-76-78.txt3.64 KBphenaproxima
#78 2988970-78.patch16.89 KBphenaproxima
#76 interdiff-2988970-64-76.txt5.47 KBphenaproxima
#76 2988970-76.patch16.76 KBphenaproxima
#64 interdiff-2988970-60-64.txt426 bytesphenaproxima
#64 2988970-64.patch15.12 KBphenaproxima
#60 interdiff-2988970-57-60.txt465 bytesphenaproxima
#60 2988970-60.patch15.13 KBphenaproxima
#60 2988970-60-overrides-umami.png726.61 KBphenaproxima
#60 2988970-60-defaults-umami.png91.63 KBphenaproxima
#57 interdiff-2988970-54-57.txt427 bytesphenaproxima
#57 2988970-57.patch15.14 KBphenaproxima
#54 interdiff-2988970-53-54.txt870 bytesphenaproxima
#54 2988970-54.patch14.53 KBphenaproxima
#53 interdiff-2988970-49-53.txt1.42 KBphenaproxima
#53 2988970-53.patch14.52 KBphenaproxima
#49 interdiff-2988970-46-49.txt1.62 KBphenaproxima
#49 2988970-49.patch14.52 KBphenaproxima
#48 interdiff-2988970-43-46.txt4.13 KBphenaproxima
#46 2988970-46-overrides-rtl.png40.72 KBphenaproxima
#46 2988970-46-overrides-ltr.png37.97 KBphenaproxima
#46 2988970-46-defaults-rtl.png74.5 KBphenaproxima
#46 2988970-46-defaults-ltr.png53.86 KBphenaproxima
#46 2988970-46.patch14.5 KBphenaproxima
#43 interdiff-2988970-42-43.txt2.13 KBphenaproxima
#43 2988970-43.patch13.31 KBphenaproxima
#42 interdiff-2988970-38-42.txt10.19 KBphenaproxima
#42 2988970-42.patch11.87 KBphenaproxima
#40 icons.zip2.91 KBdyannenova
#38 2988970-message-38.patch3.94 KBtim.plunkett
#36 8.7 Stable - Default vs Overrides - Default Icon - 1.3.3.png1.54 MBdyannenova
#36 8.7 Stable - Default vs Overrides - Override Icon - 1.3.3.png2.3 MBdyannenova
#35 default-vs-override-two-links.txt3.1 KBbnjmnm
#35 default-vs-override-single-link.txt139.7 KBbnjmnm
#35 default-vs-override-two-links.png117.52 KBbnjmnm
#35 default-vs-override-single-link.png229.61 KBbnjmnm
#32 2988970-32.patch17.69 KBbnjmnm
#26 2988970-26.patch17.16 KBtedbow
#26 interdiff-24-26.txt3.43 KBtedbow
#24 2988970-24.patch14.07 KBtedbow
#24 interdiff-21-24.txt1.09 KBtedbow
#21 2988970-localtask-21.patch14.07 KBtim.plunkett
#8 2988970-localtask-8.patch14.53 KBtim.plunkett
#7 2988970-local-tasks-refactor-7.patch11.68 KBsugaroverflow

Comments

bkosborne created an issue. See original summary.

tim.plunkett’s picture

Assigned: Unassigned » dyannenova

Assigning to @DyanneNova for input

tim.plunkett’s picture

Issue tags: +sprint
sugaroverflow’s picture

Assigned: dyannenova » sugaroverflow

reassigning to work on MWDS2018 :D

sugaroverflow’s picture

Issue tags: +MWDS2018
tedbow’s picture

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

sugaroverflow’s picture

StatusFileSize
new11.68 KB

Worked on the first part of this today - moving the code to create local tasks from the Derivative into the SectionStorage classes.

tim.plunkett’s picture

Status: Active » Needs review
Issue tags: +Usability
StatusFileSize
new14.53 KB

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

sugaroverflow’s picture

Status: Needs work » Needs review

Docker hub was down due to maintenance so the patch failed. We retested and it passed ✌️

tim.plunkett’s picture

Assigned: sugaroverflow » Unassigned
tim.plunkett’s picture

tim.plunkett’s picture

Assigned: Unassigned » dyannenova

This need some work from @DyanneNova, not ready for wider review.

aaronmchale’s picture

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

aaronmchale’s picture

aaronmchale’s picture

Maybe the ideas in this issue are something to think about.

bkosborne’s picture

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.

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

aaronmchale’s picture

Another related issue, maybe there’s some cross-over here.

tedbow’s picture

+++ b/core/modules/layout_builder/tests/src/Functional/LayoutBuilderTest.php
@@ -198,12 +198,12 @@ public function testLayoutBuilderUi() {
-    $assert_session->pageTextContains('Placeholder for the "Extra label" field');
+    $assert_session->pageTextContains('Extra, Extra read all about it.');

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

tim.plunkett’s picture

That change is needed for the new flow of things. However we're not set on the given proposal yet...

tim.plunkett’s picture

tedbow’s picture

+++ b/core/modules/layout_builder/src/Plugin/SectionStorage/OverridesSectionStorage.php
@@ -163,13 +173,20 @@ public function buildRoutes(RouteCollection $collection) {
+      $local_tasks["layout_builder.overrides.$entity_type_id.revert"] = $base_plugin_definition + [
+        'route_name' => "layout_builder.overrides.$entity_type_id.revert",

I 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.revert is being used twice.

Right now there is not test for local task and where it redirects so that is why the tests pass.

tim.plunkett’s picture

Issue tags: +Blocks-Layouts
tedbow’s picture

StatusFileSize
new1.09 KB
new14.07 KB

Fixed #22

re #8

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.

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.

tedbow’s picture

Status: Needs work » Needs review
StatusFileSize
new3.43 KB
new17.16 KB
  1. \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.
  2. Added new test to confirm the redirect works correctly with and without an override.
aaronmchale’s picture

Leaning 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).

tedbow’s picture

Status: Needs work » Needs review

#27 seemed to be drupalci error. Retested and passed

tim.plunkett’s picture

+++ b/core/modules/layout_builder/src/Plugin/SectionStorage/OverridesSectionStorage.php
@@ -228,7 +245,8 @@ protected function getEntityTypes() {
-    return LayoutBuilderEntityViewDisplay::collectRenderDisplay($this->getEntity(), 'full');
+    $section_list = LayoutBuilderEntityViewDisplay::collectRenderDisplay($this->getEntity(), 'full');
+    return $this->sectionStorageManager->loadEmpty('defaults')->setSectionList($section_list);

Whoa, 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

tim.plunkett’s picture

Status: Needs review » Needs work

Needs reroll and or rethinking of approach.

bnjmnm’s picture

StatusFileSize
new17.69 KB

Re #31

Needs reroll and or rethinking of approach.

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

bnjmnm’s picture

Status: Needs work » Needs review
bnjmnm’s picture

Status: Needs review » Needs work
bnjmnm’s picture

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

dyannenova’s picture

On 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:

Mockup of overriden content layout editing

Mockup of default layout editing

tim.plunkett’s picture

tim.plunkett’s picture

Status: Needs work » Needs review
StatusFileSize
new3.94 KB

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

dyannenova’s picture

StatusFileSize
new2.91 KB

I've attached the icon files in a zip because svgs can't be uploaded here.

phenaproxima’s picture

Assigned: dyannenova » Unassigned

Thanks, @DyanneNova! Unassigning.

phenaproxima’s picture

Issue tags: +Needs tests, +Needs screenshots
StatusFileSize
new11.87 KB
new10.19 KB

Still needs tests and styling, but here is a patch which includes the SVGs as well.

phenaproxima’s picture

Status: Needs work » Needs review
Issue tags: -Needs tests
StatusFileSize
new13.31 KB
new2.13 KB

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

tim.plunkett’s picture

+++ b/core/modules/layout_builder/src/Form/DefaultsEntityForm.php
@@ -64,10 +77,43 @@ public function buildForm(array $form, FormStateInterface $form_state, SectionSt
+      '#type' => 'html_tag',
+      '#tag' => 'div',
...
+      '#value' => $this->t('You are editing the layout template for all @bundle @plural_label.', [

Use '#type' => 'container' and s/'#value'/'message'

phenaproxima’s picture

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

phenaproxima’s picture

Status: Needs work » Needs review

Forgot to set it to NR!

phenaproxima’s picture

StatusFileSize
new4.13 KB

Oh, and I also forgot the interdiff.

phenaproxima’s picture

StatusFileSize
new14.52 KB
new1.62 KB

This one fully addresses @tim.plunkett's feedback in #44. (Patch #46 only partially addresses it.)

tim.plunkett credited xjm.

tim.plunkett’s picture

Assigned: Unassigned » dyannenova
Issue tags: -MWDS2018
  1. +++ b/core/modules/layout_builder/src/Form/DefaultsEntityForm.php
    @@ -64,10 +77,44 @@ public function buildForm(array $form, FormStateInterface $form_state, SectionSt
    +  private function buildMessage(LayoutEntityDisplayInterface $entity) {
    
    +++ b/core/modules/layout_builder/src/Form/OverridesEntityForm.php
    @@ -107,9 +109,46 @@ public function buildForm(array $form, FormStateInterface $form_state, SectionSt
    +  private function buildMessage(EntityInterface $entity, OverridesSectionStorageInterface $section_storage) {
    

    Nit: These don't actually need to be private, might as well switch it back to protected :\

  2. +++ b/core/modules/layout_builder/src/Form/OverridesEntityForm.php
    @@ -107,9 +109,46 @@ public function buildForm(array $form, FormStateInterface $form_state, SectionSt
    +          'layout-builder__message',
    +          'layout-builder__message--overrides',
    

    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.

phenaproxima’s picture

StatusFileSize
new14.52 KB
new1.42 KB

Changed the methods to protected.

phenaproxima’s picture

StatusFileSize
new14.53 KB
new870 bytes

Added a missing </a>.

Status: Needs review » Needs work

The last submitted patch, 54: 2988970-54.patch, failed testing. View results

phenaproxima’s picture

Status: Needs work » Needs review
StatusFileSize
new15.14 KB
new427 bytes

On @bnjmnm's advice, I tried adding layout_builder_test_css_transitions to the modules enabled for TestMultiWidthLayoutTest. Let's see if that helps.

tim.plunkett’s picture

Issue tags: +Layout Builder frontend issue
dyannenova’s picture

The 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

phenaproxima’s picture

Issue summary: View changes
StatusFileSize
new91.63 KB
new726.61 KB
new15.13 KB
new465 bytes

Fixed. Adding screenshots to the IS too.

tim.plunkett’s picture

+++ b/core/modules/layout_builder/css/layout-builder.css
@@ -78,8 +78,8 @@
+  background-color: #f7efcf;
...
-  background-color: rgb(248, 236, 185);

For the record, the new value is equivalent to rgb(247, 239, 207). Not sure if you wanted to keep it that way.

dyannenova’s picture

Status: Needs review » Reviewed & tested by the community

This looks good to me!

tim.plunkett’s picture

Assigned: dyannenova » Unassigned
Status: Reviewed & tested by the community » Needs work
+++ b/core/modules/layout_builder/css/layout-builder.css
@@ -75,6 +75,35 @@
+  border: 1px solid rgb(180, 160, 46);

I 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?

phenaproxima’s picture

Status: Needs work » Needs review
StatusFileSize
new15.12 KB
new426 bytes

Fixed!

tim.plunkett’s picture

Status: Needs review » Reviewed & tested by the community

Thanks!

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 64: 2988970-64.patch, failed testing. View results

phenaproxima’s picture

Status: Needs work » Reviewed & tested by the community

Unrelated (known random) test failure in Media Library.

xjm’s picture

Are all the UX meeting contributors credited here as well?

webchick’s picture

They are now! Crediting from UX 1/22 meeting: https://www.youtube.com/watch?v=QbrxHvjQOCU

larowlan’s picture

  1. +++ b/core/modules/layout_builder/src/Form/OverridesEntityForm.php
    @@ -107,9 +109,46 @@ public function buildForm(array $form, FormStateInterface $form_state, SectionSt
    +      '#type' => 'container',
    

    any reason not to use '#theme' => 'messages' here so it looks consistent with any front-end theme?

  2. +++ b/core/modules/layout_builder/src/Form/OverridesEntityForm.php
    @@ -107,9 +109,46 @@ public function buildForm(array $form, FormStateInterface $form_state, SectionSt
    +        '#markup' => $this->t('You are editing the layout for this @bundle @singular_label. <a href=":link">Edit the template for all @bundle @plural_label instead.</a>', [
    ...
    +          ':link' => $section_storage->getDefaultSectionStorage()->getLayoutBuilderUrl()->toString(),
    

    should we be checking they have access to edit the default before showing the link?

  3. +++ b/core/modules/layout_builder/tests/src/FunctionalJavascript/TestMultiWidthLayoutsTest.php
    @@ -20,6 +20,7 @@ class TestMultiWidthLayoutsTest extends WebDriverTestBase {
    +    'layout_builder_test_css_transitions',
    

    what is this change for? nevermind saw #57

lauriii’s picture

Status: Reviewed & tested by the community » Needs work

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

tim.plunkett’s picture

#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

Version: 8.7.x-dev » 8.8.x-dev

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

phenaproxima’s picture

Status: Needs work » Needs review
StatusFileSize
new16.76 KB
new5.47 KB

Let's see how the URL access check works. I'm not sure why the interdiff shows CSS changes; maybe I moved stuff around. Whatevs!

Status: Needs review » Needs work

The last submitted patch, 76: 2988970-76.patch, failed testing. View results

phenaproxima’s picture

Status: Needs work » Needs review
StatusFileSize
new16.89 KB
new3.64 KB

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

tim.plunkett’s picture

  1. +++ b/core/modules/layout_builder/src/Form/OverridesEntityForm.php
    @@ -107,9 +109,57 @@ public function buildForm(array $form, FormStateInterface $form_state, SectionSt
    +    if ($defaults_link->access($this->currentUser())) {
    +      $message = 'You are editing the layout for this @bundle @singular_label. <a href=":link">Edit the template for all @bundle @plural_label instead.</a>';
    +    }
    +    else {
    +      $message = 'You are editing the layout for this @bundle @singular_label.';
    +    }
    ...
    +        '#markup' => $this->t($message, [
    +          '@bundle' => $bundle_info[$entity->bundle()]['label'],
    +          '@singular_label' => $entity_type->getSingularLabel(),
    +          '@plural_label' => $entity_type->getPluralLabel(),
    +          ':link' => $section_storage->getDefaultSectionStorage()->getLayoutBuilderUrl()->toString(),
    +        ]),
    

    AFAIK 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 :link to the $args in the if, since it's not needed in the else.

  2. +++ b/core/modules/layout_builder/tests/src/Functional/LayoutBuilderTest.php
    @@ -63,6 +64,30 @@ protected function setUp() {
    +    $this->assertInstanceOf(LayoutBuilderEntityViewDisplay::class, $display);
    ...
    +    $this->assertSame(SAVED_UPDATED, $display->save());
    

    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

  3. +++ b/core/modules/layout_builder/tests/src/Functional/LayoutBuilderTest.php
    @@ -63,6 +64,30 @@ protected function setUp() {
    +    // @todo This should not be necessary.
    +    $this->container->get('entity_field.manager')->clearCachedFieldDefinitions();
    

    Are we sure this is necessary? Can we try it without?

Can you post a FAIL patch as well with the next iteration? Thanks!

phenaproxima’s picture

StatusFileSize
new3.41 KB
new16.62 KB

All fixed!

phenaproxima’s picture

StatusFileSize
new2.92 KB

Sorry, forgot the interdiff!

The last submitted patch, 78: 2988970-78.patch, failed testing. View results

Status: Needs review » Needs work

The last submitted patch, 80: 2988970-80.patch, failed testing. View results

phenaproxima’s picture

Status: Needs work » Needs review
StatusFileSize
new18.63 KB
new1.79 KB

@bnjmnm explained the test failure to me. To quote him (and I added this comment in the test):

The test checks coordinates before and after the mouse pointer is used and compares the Y position. Because`.layout-builder__message` wraps (and changes the Y position in the test) when the off canvas dialog opens, the "before" coordinates must be collected _after_ off canvas opens.

So that's why I'm changing LayoutBuilderDisableInteractionsTest in this patch.

The last submitted patch, 78: 2988970-78.patch, failed testing. View results

dyannenova’s picture

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

tim.plunkett’s picture

Status: Needs review » Reviewed & tested by the community

Great, thanks everyone! Looking forward to getting this one in

lauriii’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +Accessibility

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

lauriii’s picture

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

andrewmacpherson’s picture

@lauriii asked in Slack if I would look at this..

I could use your feedback whether we should include visually hidden title for the message that is being added here:

Can you clarify:

  1. What message it is for, and undee what circumstances it appears.
  2. Where it appears. Does the position vary?
  3. Whether the message is in the HTML source, or added dynamically after page load.
  4. What visually-hidden text you propose.
  5. Crucially, what do you think the message is lacking, to warrant extra visually-hidden text?

Edit: also, by title, do you mean heading?

lauriii’s picture

@andrewmacpherson

I hope this provides more context to my request:

  1. The message appears always when layout builder is rendered. There's a different message for the edit default layout page and the edit layout override page.
  2. It is always rendered right before the layout builder. It doesn't vary.
  3. It is in the HTML source.
  4. I didn't have any specific text in mind.
  5. I was only considering this because we chose not to use the pre-existing message component and this is something that is currently missing from that component. The problem could be the fact that it looks like a message, but when you are unable to see the page visually, you would think it's just a block of text on the page.
  6. Yes, I meant heading.
xjm’s picture

+++ b/core/modules/layout_builder/css/layout-builder.css
@@ -83,6 +83,35 @@
+}
+[dir="rtl"] .layout-builder__message:before {

Another missing CSS newline. :)

lauriii’s picture

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

xjm’s picture

Yeah I'm wrong about #92; disregard.

lauriii’s picture

Issue summary: View changes
StatusFileSize
new33.74 KB

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

dyannenova’s picture

StatusFileSize
new16.55 KB

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

Image of the message colors

lauriii’s picture

Thank you @DyanneNova! Before we can start implementing this, we still need colors/designs for hover, focus, and active states.

dyannenova’s picture

Let'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.

lauriii’s picture

Status: Needs work » Needs review
StatusFileSize
new18.93 KB
new1.1 KB
new39.65 KB

Implemented the color changes and it looks following:

tedbow’s picture

StatusFileSize
new16.92 KB

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

xjm’s picture

Issue tags: +Needs screenshots

Can we get Bartik screenshots as well?

bnjmnm’s picture

Status: Needs review » Needs work
StatusFileSize
new39.99 KB
new51.53 KB

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

balsama’s picture

Issue summary: View changes
StatusFileSize
new216.35 KB
new207.62 KB

Added Bartik screenshots to IS.

tim.plunkett’s picture

Issue tags: -Needs screenshots

#102
I agree 100%. We did this for permissions too, by checking $entity_type->hasKey('bundle')

#103
Thanks!

balsama’s picture

Realized 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?

tim.plunkett’s picture

Status: Needs work » Needs review
StatusFileSize
new19.05 KB
new4.86 KB

Implemented #102, with test coverage

bnjmnm’s picture

Reviewed the code and I can RTBC this once the CSS from @lauriii gets +1'd

dyannenova’s picture

+1 to the CSS changes.

bnjmnm’s picture

Status: Needs review » Reviewed & tested by the community
lauriii’s picture

The 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 🧚‍♂️✨

webchick’s picture

Status: Reviewed & tested by the community » Needs work
StatusFileSize
new411.33 KB

Spent 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.)

Standard warning,

@DyanneNova and @tim.plunkett explained the rationale for this, which is:

  1. We don't want to use standard MessengerInterface stuff, because this important info might get lost in the shuffle if there's other info/warnings being displayed. See https://www.drupal.org/node/add/project-issue/drupal for a great example of "drupal_set_message() overload." :P Hence, it needs to be located in the area that it's in, because it's important info we want to make sure people actually see (makes sense).
  2. We don't want to use stock "warning" style, because it's not actually a warning, per se. The user hasn't done anything wrong, nothing needs to be corrected. (Makes sense, also. However, the "similar enough" yellow colour still makes it look like a warning, at least to my non-designer eye).
  3. We also don't want to use "status" type, because once again the user hasn't done anything that we need to signal is "Ok / Succeeded." (Though could we borrow the styling and just change the icon?)
  4. An ideal situation would be an "info" kind of box, because that's exactly what this is. Info. However, somewhere along the way we lost the "info" type that I swear we used to have in like Drupal 6 or something? And adding it would be an API change, which we can't do during beta. Touché.
  5. Complicating matters, because Layout Builder isn't stable yet, we can't adjust message styling in other themes. So getting the same message to look good in both Bartik/Seven and Umami is going to be... tricky (recommendation from @xjm was to worry about Bartik for now, since Umami is "perma-experimental").

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

tim.plunkett’s picture

StatusFileSize
new19.34 KB
new1.23 KB

Not yet addressing #111, but this fixes a constructor change that xjm requested.
Leaving NW.

webchick’s picture

For reference: #375928: Add type "info" to Drupal Messenger service (Wow, 6-digit node iD!)

tim.plunkett’s picture

#111

1) Thankfully we can use #theme => status_messages directly (as opposed to the messenger service itself or even #type => status_messages, this sidesteps this problem

2) 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 status to info if #375928: Add type "info" to Drupal Messenger service lands (#111.4)

webchick’s picture

The screenshots in #114 look great to me, FWIW.

lauriii’s picture

Issue summary: View changes
Status: Needs review » Needs work
StatusFileSize
new26.58 KB


Looks good in Bartik. Let's make this work in Umami as well. ✌️

tim.plunkett’s picture

Classy (and therefore every other stable core theme) uses .messages for the background image.
Specifically in this case .messages--status
Umami uses .messages--status .messages__content
That's a bug in Umami, no?

tim.plunkett’s picture

Status: Needs work » Needs review
StatusFileSize
new18.98 KB
new2.94 KB
new474.13 KB

Added a workaround to fix #116 for now, #3043228: Add Umami-specific styling for Layout Builder messages can fix it correctly once LB is stable.

tim.plunkett’s picture

StatusFileSize
new19.22 KB
new824 bytes

Nope, wrong patch and wrong interdiff. NOW its right

dyannenova’s picture

Status: Needs review » Reviewed & tested by the community

This looks good to me. I think this is ready to go!

lauriii’s picture

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

  • webchick committed 30abfa6 on 8.8.x
    Issue #2988970 by phenaproxima, tim.plunkett, tedbow, bnjmnm, lauriii,...

  • webchick committed d5aa81a on 8.7.x
    Issue #2988970 by phenaproxima, tim.plunkett, tedbow, bnjmnm, lauriii,...
webchick’s picture

Status: Reviewed & tested by the community » Fixed

Great! 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!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

maskedjellybean’s picture

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

bnjmnm’s picture

This is more clear about what effect modifying the default layout will have on existing content. Which is nothing.

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