Warning: Cannot use a scalar value as an array

Created on 24 March 2021, about 3 years ago
Updated 2 February 2023, over 1 year ago

Problem/Motivation

In the plugin settings form in the text format configuration page, the description says in bold:

(Note:- Please ensure you have enabled "Limit allowed HTML tags and correct faulty HTML" filter for this setting to take effect.)

If a site builder goes ahead and adds a value without enabling the filter, then editors will see the following warning on every node form (or likely, an entity form that makes use of a formatted text input):

Warning: Cannot use a scalar value as an array in /Users/myuser/Sites/mysite/docroot/modules/contrib/ckeditor_acr/ckeditor_acr.module on line 48

Steps to reproduce

Install CKEditor ACR and for one of the text formats add a value such as "a{!href]" in the CKEditor Allowed Content Rules configuration vertical tab but do NOT enable the "Limit allowed HTML tags and correct faulty HTML" filter for the format, and save the text format.

Go to a node creation form and observe the error above the body field's WYSIWYG editor.

Proposed resolution

Within ckeditor_acr_editor_js_settings_alter() check that $editor['editorSettings']['allowedContent'] before trying to inject any provided rules as allowedContent settings.

🐛 Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

🇨🇦Canada mandclu

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