Cannot save layouts with classes or attributes in col/row/container.

Created on 22 February 2023, almost 2 years ago
Updated 7 April 2023, over 1 year ago

Problem/Motivation

I have a longstanding site that has been using BLB from since I migrated it from D7 -> D9. Suddenly, I cannot save layouts that have classes or attributes assigned to col, row, or container. The error messages are:

InvalidArgumentException: The configuration property third_party_settings.layout_builder.sections.3.layout_settings.container_wrapper_attributes.id doesn't exist. in Drupal\Core\Config\Schema\ArrayElement->get() (line 76 of core/lib/Drupal/Core/Config/Schema/ArrayElement.php).

I have reproduced the same thing (but with varying error messages) in vanilla D9 and D10 sites.

Steps to reproduce

  1. create a new BLB section
  2. save (saves and displays OK)
  3. add a class or attribute to the container within the BLB section
  4. try to save: wsod with some variation of the error message above in error log
πŸ› Bug report
Status

Active

Version

2.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States mkindred

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @mkindred
  • πŸ‡ΊπŸ‡ΈUnited States mkindred

    I confirmed that these issues don't occur on a vanilla D9 site using BLB 2.0.1.

  • πŸ‡ΊπŸ‡ΈUnited States mkindred
  • πŸ‡ΊπŸ‡ΈUnited States mkindred

    It looks as though commit 9012d81 from #3292760 πŸ› Column classes are not inserted to Twig template, only the word "Array." Fixed might be the culprit. I installed 2.1.1 and backed out that commit, and although the column bootstrap classes are now missing again, the addl classes I applied did work:

  • πŸ‡ΊπŸ‡ΈUnited States mkindred

    I created a video to show the bug: https://odysee.com/@ArsNova:6/230223-drupal-contrib-bootstrap_layout_bui...

    (This video also shows an odd bug causing multiple sections to be added at a time, instead of one.)

  • πŸ‡ΊπŸ‡ΈUnited States mkindred

    I did a few more tests, trying to find out which commit first caused these errors. It looks like it might be related the the config schema changes in/around commit 3d5a4c7 'Missing config schema'. Is it possible that the config schema is wrong for some of these attributes/classes? I didn't notice the issue until updating to 2.1.0, but the previous release was two years prior.

    I've exhausted what I can debug with my current understanding of the config schema. If someone can point me in the right direction, I don't mind spending some time to create a patch.

    (I'm hoping this wasn't due to my upgrade workflow... I'm a bit surprised that nobody else has run into this issue so far.)

  • I'm getting the same results using the same steps.

    InvalidArgumentException: The configuration property third_party_settings.layout_builder.sections.2.layout_settings.container_wrapper_attributes.data-aos-duration doesn't exist. in Drupal\Core\Config\Schema\ArrayElement->get() (line 76 of /var/www/vhosts/arts.gatech.edu/httpdocs/web/core/lib/Drupal/Core/Config/Schema/ArrayElement.php).

  • πŸ‡ΊπŸ‡ΈUnited States mkindred

    This one took a *long* time to diagnose, due to what I think are multiple bugs. There's a UI/AJAX bug that doesn't allow you to save classes or attributes unless you first tab out of the class field. And I believe the schema for attributes is incorrect.

    I documented my findings here: https://odysee.com/@ArsNova:6/230309_drupal_contrib_bootstrap_layout_bui...

    I've forked the project to provide the schema change, but since working with gitlab's 2FA / SSH keys / passwords / personal tokens is so difficult, I'll provide it as a patch as well.

    If my schema changes are correct, I'll create the MR.

  • πŸ‡¨πŸ‡¦Canada nickdjm

    I tried path #8 and it does works on a fresh install of the module. The schema changes are not picked up on a site where the module is already installed, so we'll need an update hook to resolve this properly.

  • πŸ‡ΊπŸ‡ΈUnited States mkindred

    I'm hoping someone can help me get a better understanding of this. Here's my current understanding:

    Back in January 2023, the 2.1.0 tag included commits from back in April 2021 that added config schema (commits e80fdfa and 3d5a4c7 from issue 3197371 β†’ ). Some time after I updated to 2.10 and/or 2.1.1, I found that I could no longer edit the container attributes. My patch changed two elements in the schema from string to sequence.string. After applying the patch, I can now save container attributes, export config, and import config. It seems to me that my patch aligned the schema to what was already on the dbase.

    Is this mostly correct?

    Also, if an update hook is required, how can I confirm the schema changes before and after that update hook is run?

Production build 0.71.5 2024