Library detection warnings when using contrib version of CKEditor 4

Created on 24 May 2023, over 1 year ago
Updated 1 January 2024, 11 months ago

Problem/Motivation

When using Drupal core 9.5+ or 10 and having switched over to the contrib version of CKEditor 4 there are a bunch of warnings generated by getCkEditorVersion() in ScaytCKEditorButton.php due to the library lookup still expecting to find the version number under core/ckeditor. However it's no longer available there since it's just an alias generated by ckeditor_library_info_alter() hook. The correct library to check in this situation would be ckeditor/ckeditor

Steps to reproduce

Install Drupal 10, contrib version of CKEditor 4 and CKEditor SCAYT 4.x-dev, add the button to the editor. Open a create node form with the editor present, observe a bunch of warnings being generated:

  • Warning: Undefined array key 0 in Drupal\ckeditor_scayt\Plugin\CKEditorPlugin\ScaytCKEditorButton->getCkEditorVersion()
  • Warning: Trying to access array offset on value of type null
  • etc..

Proposed resolution

Check if the core (if using <9.5) or contrib version of ckeditor 4 is enabled and use the correct extension in version detection.

🐛 Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

🇱🇻Latvia artis.bajars

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

Comments & Activities

Production build 0.71.5 2024