Problem/Motivation

There are actually two problems here:

1. Install Layout Builder Modal and enable Layout Builder and override on Basic page content type.
2. Create a basic page. Go to the layout of that node. Open some of the blocks through the contextual link Configure block.
3. Uninstall the module.
4. Go back to the layout of the created node. Try open the same blocks by the contextual link.

Expected behaviour:

They should be opened in off-canvas.

Current behaviour:

They are opened in the modal.

The second problem is that if you change some of the modal settings, the new settings are not applied to the contextual links until the session storage is cleared.

Contextual links are stored in the sessionStorage in the web browser. Is there something we can do about that?

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Comments

johndevman created an issue. See original summary.

johnwebdev’s picture

Not knowing the Contextual API too well, there seem to be a metadata property that we could use to handle this.

johnwebdev’s picture

It looks like it's too late to set new meta data in both:

hook_contextual_links_view_alter
hook_contextual_links_alter

We cannot use a block subscriber on SECTION_COMPONENT_BUILD_RENDER_ARRAY event because the Layout Builder render element will override the #contextual_links key.

This leaves us to add a pre_render element to the actual Layout Builder render element. I have a working patch locally that needs some clean up. But it solves the problem, yay!

johnwebdev’s picture

Status: Active » Needs review
Issue tags: +Needs tests
StatusFileSize
new2 KB

Here's a first patch

johnzzon’s picture

Looks good!

One nit:

+++ b/src/LayoutBuilderModal.php
@@ -0,0 +1,37 @@
+   * Pre-render callback: Adds contextual link metadata for Layout Builder Modal.

Exceeds 80 chars.

johnwebdev’s picture

Assigned: Unassigned » johnwebdev
Status: Needs review » Needs work

#5 Thanks!

Setting back to NW for tests. Also working on this :)

johnwebdev’s picture

Status: Needs work » Needs review
Issue tags: -Needs tests
StatusFileSize
new1.36 KB
new3.33 KB
new1.62 KB

The last submitted patch, 7: 3058559-7--test-only.patch, failed testing. View results

  • johndevman committed a389205 on 8.x-1.x
    Issue #3058559 by johndevman: Contextual links caches Layout Builder...
johnwebdev’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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