Warning: Undefined array key "default_layout"

Created on 22 April 2024, 7 months ago

Problem/Motivation

Multiple PHP warnings get triggered when inserting a new grid block.

Warning: Undefined array key "default_layout" in Drupal\ckeditor_bs_grid\Form\GridDialog->buildLayoutStep() (line 274 of /var/www/html/web/modules/contrib/ckeditor_bs_grid/src/Form/GridDialog.php).

The warnings are not triggered by editing an existing grid block.

// Allow defaulting by sort order instead.
      elseif ($breakpoint['columns'][$num_cols]['default_layout'] === 'order') {
        $keys = array_keys($options);
        $default_layout = $keys[1] ?? $default_layout;
      }

I don't know what the default behavior should be here, so I can't offer a fix, but I'm attaching a minimal patch to suppress the warning messages - should someone need it.

Steps to reproduce

PHP 8.2.15
Drupal core 10.2.5
CKEditor Bootstrap Grid 2.0.11

  1. Start creating or editing content.
  2. Click on the insert grid icon.
  3. Click next.
  4. Check the logs for the triggered warnings.

Proposed resolution

Fix the default logic.

Remaining tasks

User interface changes

API changes

Data model changes

๐Ÿ› Bug report
Status

Active

Version

2.0

Component

Code

Created by

๐Ÿ‡ญ๐Ÿ‡บHungary karol haltenberger

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024