In core/modules/layout_builder/src/Form/DefaultsEntityForm the status messages are added as a render array, which prevents them from being rendered with the StatusMessages class.

If the messenger is used instead, it will make the message display more flexible.

CommentFileSizeAuthor
#7 interdiff_4-7.txt4.52 KBzrpnr
#7 3096681-7.patch5.47 KBzrpnr
#4 3096681-4.patch2.03 KBzrpnr

Comments

zrpnr created an issue. See original summary.

zrpnr’s picture

tim.plunkett’s picture

Component: field_layout.module » layout_builder.module
Issue tags: +Blocks-Layouts
zrpnr’s picture

Status: Active » Needs review
StatusFileSize
new2.03 KB

Still investigating whether #2988970: Layout Builder should make it easier to modify the default layout for an entity type when viewing an entity and #3043228: Add Umami-specific styling for Layout Builder messages are a conflict with this change.
This patch keeps the render array mostly intact and uses messenger to addMessage.

Status: Needs review » Needs work

The last submitted patch, 4: 3096681-4.patch, failed testing. View results

zrpnr’s picture

This helped with the overrides, but because messages are duplicated in the status message block and the layout builder area it fails the functional tests.
Fully removing the return value for buildMessage prevents the "you are editing the layout" duplicate.
That lets it pass LayoutBuilderDisableInteractionsTest and LayoutBuilderUiTest.
However the ajax "unsaved changes" message will still appear in the status message block and the layout builder area.

I think this is also related to #3023228: Layout builder is showing two status messages

zrpnr’s picture

Status: Needs work » Needs review
StatusFileSize
new5.47 KB
new4.52 KB

An option to remove the duplicates is to entirely remove the lb specific markup and only use the Messenger.
This means also changing the selector in 3 functional tests in LayoutBuilderTest.

However, this causes a regression - losing the special icons added in #2988970: Layout Builder should make it easier to modify the default layout for an entity type when viewing an entity
and doesn't prevent the ajax message from appearing in the form markup after a layout change.

zrpnr’s picture

I posted a patch to #3100473: Allow additional message types, I think that approach could work for LB to add in the special classes that would be removed in #7

tim.plunkett’s picture

Status: Needs review » Postponed

This is a fine patch as-is, but the tests show the regression. Those CSS classes are vaguely important for the styling, so we need to postpone this for now on the issue linked in #8

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.