Warning: Undefined array key "default_layout"

Created on 22 April 2024, 2 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).

// 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.

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

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

RTBC

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.69.0 2024