Problem/Motivation

When you try to add/edit a section, the ajax request fails.

Warning: foreach() argument must be of type array|object, string given in /var/www/html/web/core/lib/Drupal/Core/Render/Element/Checkboxes.php on line 113

Steps to reproduce

- Install the module and don't change default settings on the /admin/config/content/layout-builder-section-attributes form.
- Add or edit a section of a layout builder.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

cbccharlie created an issue. See original summary.

  • c419d8b committed on 1.0.x
    Issue #3308552: Error when trying to add/edit a section
    
kaszarobert’s picture

Version: 1.0.3 » 1.0.x-dev
Status: Active » Fixed

Good catch! Thanks for your fix, I committed.

There's one last thing I'd like to ask: you mention in the issue that the AJAX request fails for you. I reproduced the PHP Warning but the AJAX calls were working for me. I tested it on latest Drupal 9, and on PHP 7.4 and PHP 8.1. The MR fixes the PHP Warnings fine.

@cbccharlie after this fix do you encounter these AJAX errors? If not, I'll put out a new release.

cbccharlie’s picture

With this fix the errors disappear. Thanks @kaszarobert!

kaszarobert’s picture

Title: Error when trying to add/edit a section » PHP Warning when trying to add/edit a section when no predefined classes are defined in the "Choose classes" element
Issue summary: View changes

Okay, the fix is available in 1.0.4.

Status: Fixed » Closed (fixed)

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