- Issue created by @codechefmarc
- πΊπ¦Ukraine Panchuk Volyn, Lutsk
Sounds like a bug..
Thanks for the issue report, I'll take a look - πΊπΈUnited States codechefmarc
An update for you and my solution. I don't think this is a bug - I think the module is working as intended, it was just a bit tricky to figure out how to update existing, overridden, layouts. We can close this if you wish.
So, here is my solution I did in an deploy hook and it worked beautifully:
$nids = \Drupal::entityQuery('node')->condition('type', 'page')->execute(); foreach ($nids as $nid) { $node = Node::load($nid); $layout = $node->get('layout_builder__layout'); /** @var \Drupal\layout_builder\Field\LayoutSectionItemList $layout */ $sections = $layout->getSections(); foreach ($sections as $section) { if ($section->getLayoutSettings()['label'] == 'Content Section') { $section->unsetThirdPartySetting('layout_builder_lock', 'lock'); $section_storage = $this->getSectionStorageForEntity($node); $tempStore = \Drupal::service('layout_builder.tempstore_repository'); $tempStore->set($section_storage); $node->save(); } } }
We needed to remove all layout builders lock settings, so this worked. But if anyone else needs something similar, another method would allow you to programmatically set any third party settings. See here: https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Config%21...