insert_editor_js_settings_alter() assumes CKEditor 4 is enabled, crashes otherwise

Created on 10 October 2022, about 2 years ago
Updated 8 February 2023, almost 2 years ago

Problem/Motivation

insert_editor_js_settings_alter() blindly assumes the ckeditor text editor plugin is used (i.e. CKEditor 4).

This causes crashes like this if any other text editor is used:

The website encountered an unexpected error. Please try again later.
TypeError: array_keys(): Argument #1 ($array) must be of type array, null given in array_keys() (line 833 of modules/insert/insert.module).
array_keys(NULL) (Line: 833)
insert_editor_js_settings_alter(Array, NULL, NULL) (Line: 562)
Drupal\Core\Extension\ModuleHandler->alter('editor_js_settings', Array) (Line: 88)
Drupal\editor\Plugin\EditorManager->getAttachments(Array) (Line: 100)
Drupal\editor\Element->preRenderTextFormat(Array)
[…]

Steps to reproduce

Use another text editor, like CKEditor 5.

Proposed resolution

Check which text editor is used by a particular text format before starting to alter settings.

Remaining tasks

TBD

User interface changes

None.

API changes

None.

Data model changes

None.

🐛 Bug report
Status

Closed: duplicate

Version

2.0

Component

Code

Created by

🇧🇪Belgium wim leers Ghent 🇧🇪🇪🇺

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024