- ๐ง๐ชBelgium flyke
A bit of a relief to know I'm not the only one facing this problem. I did spent quite a lot of time figuring this out and coming up with a woking solution. Glad that it has helped someone. Maybe someone could use my code as a starting point to make it more elegant/efficient and include revisions.
Since my custom code to get all layoutbuilder nodes as only 2 lines, I will update my code examply from above so everyone could copy/paste it.
- ๐ง๐ชBelgium L_VanDamme
Rebased the MR from 11.x.
As far as I can tell, it still has issues when editing changed blocks after reverting revisions. I might take a look at that later, for now, it should work as before and apply to 11.x.
- ๐ฆ๐บAustralia acbramley
@flyke thanks for that, I was investigating how to remove this key myself for quite a while and came up short. The main issue I was running into is that when you save the node, the LayoutSectionItemList::equals was stopping the old data from being overwritten because toArray drops the key, therefore it doesn't save. However, since you're creating a new component (and therefore new UUID) it should work!
You also need to do this for every revision, otherwise you get the same errors on the revisions page as well.
- ๐ง๐ชBelgium flyke
If I try to find the origin of these errors, I edited
web/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php
and addeddpm($row->$column_name);
right before line 1263. Result is in attached schreenshot. The value of $column_name is layout_builder__layout_section. So I guess this is the serialized data of an existing layoutbuilder section that was no problem at all when the project was on D10 (including diff from this issue) but is a problem now when the project is updates to D11 (including diff from this issue).I have no idea on how to remove this data from existing sections. I cannot create edit or save sections or blocks using layoutbuilder becasue that too shows these errors.
- ๐ง๐ชBelgium flyke
If I use MR 5053 on Drupal 11.1.1 I get multiple notices on each page:
Deprecated: Creation of dynamic property Drupal\layout_builder\SectionComponent::$legacyAdditionalModuleKey is deprecated in /var/www/html/web/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php on line 1264
- heddn Nicaragua
Update tests added and are green now. IS seems up to date. Ready for review.