Checkboxes default reverts to empty string

Created on 6 May 2025, 2 months ago

The default value for checkboxes is reverting to a string despite an array being provided in YML. If errors are being displayed this causes invalid JSON in the AJAX call which prevents layouts from being created or saved.

Example AJAX output:

Warning: foreach()argument must be of type array|object,
null given in /app/web/core/lib/Drupal/Core/Render/Element/Checkboxes.php on line 113[
    {
        "command": "settings",
        "settings": {
            "ajaxPageState": {
                "theme": "admin_overrides",

As a temporary solution we can disable displaying errors.

ini_set('display_errors', FALSE);

Example configuration:

  layout_hide:
    title: 'Hide this layout'
    description: "This layout and content will be hidden by CSS. You may wish to add an ID attribute to target this layout in Optimize or other tools."
    default: []
    plugin: layout_options_class_checkboxes
    inline: false
    options:
      layout--hidden: 'Hide this layout (hidden if true).'
    layout: true
    regions: false
🐛 Bug report
Status

Active

Version

1.7

Component

Code

Created by

🇦🇷Argentina weemondo

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

Comments & Activities

Production build 0.71.5 2024