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
- Start creating or editing content.
- Click on the insert grid icon.
- Click next.
- Check the logs for the triggered warnings.
Proposed resolution
Fix the default logic.
Remaining tasks
User interface changes
API changes
Data model changes
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | beforepatch.png | 76.8 KB | mitthukumawat |
| ckeditor_bs_grid-suppress_warnings.patch | 616 bytes | karol haltenberger |
Issue fork ckeditor_bs_grid-3442400
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
Comment #2
karol haltenberger commentedComment #5
abhishek_gupta1 commented@Karol Haltenberger , above patch fixed the issue, verified locally, also I created MR. please review it once.
Comment #6
mitthukumawat commentedI have verified this fix. Taken the pull from this issue branch and it resolved the warning.
Comment #9
b_sharpe commentedThanks!
Comment #11
karol haltenberger commented@b_sharpe So I don't really care about such stuff...but shouldn't I be also credited here.