Hi,

I am developping a module which adds "advanced actions" to the new Drupal 8 Layout Builder.

For example, cloning a page layout into another, reordering sections inside a page layout, etc. For the moment i essentially use custom database queries in order to achieve this, and this is working quite well (despite the fact that this probably is not the correct way to do this).

The main problem with this approach is that Layout Builder seems to has its own cache system which is linked to the logged in user, so when i make some changes in the database, the changes do not appear when going back to layout edit (/node/{node}/layout), while they are visible on the node view page (/node/{node}).

I use drupal_flush_all_caches() after each actions (allows for changes to be visible on the node view page), but this does not seem sufficient for the layout edit page...

Any ideas would be welcome !

Comments

EricRondo’s picture

I solved my problem looking at other Layout Builder classes, using the API was the key...

mattjones86’s picture

Out of interest, did you ever release this module? We have exactly this requirement and it would be useful if this function was already available.

EricRondo’s picture

Sorry i didn't had time for creating a proper module, but i can send you some working code examples if you want, give me you email or other..

alejo-moreno’s picture

Hey @EricRondo, we're also trying to achieve this, could you please share with us the code examples at info@codelar.co

While doing some research, most of the problems with this feature is that a lot of Inline Blocks are created which leaves a great amount of records in the custom block library. Also if blocks are not being cloned, one could end up with 2 copies of the same reference which leads to overwrite always the original content no matter what node is being edited. Appreciate any help.