Problem/Motivation
A text format whose Ace Editor settings are stored flat, without the fieldset wrapper, raises six PHP messages on every render of a text format element:
Warning: Undefined array key "fieldset" in Drupal\ace_editor\Plugin\Editor\AceEditor->getLibraries() (line 165) Warning: Trying to access array offset on null in Drupal\ace_editor\Plugin\Editor\AceEditor->getLibraries() (line 165) Deprecated function: trim(): Passing null to parameter #1 ($string) of type string is deprecated in Drupal\ace_editor\Plugin\Editor\AceEditor->getLibraries() (line 165) Warning: Undefined array key "fieldset" in Drupal\ace_editor\Plugin\Editor\AceEditor->getLibraries() (line 166) Warning: Trying to access array offset on null in Drupal\ace_editor\Plugin\Editor\AceEditor->getLibraries() (line 166) Deprecated function: trim(): Passing null to parameter #1 ($string) of type string is deprecated in Drupal\ace_editor\Plugin\Editor\AceEditor->getLibraries() (line 166)
settingsForm() and getJsSettings() both accept the two shapes the module can store: settings saved through the configuration form are nested under fieldset, while configuration created programmatically, by a recipe, a config import or an older release keeps them at the top level. getLibraries() is the only one that does not, and indexes ['fieldset']['theme'] and ['fieldset']['syntax'] unconditionally.
Beyond the messages the theme is also wrong: $theme and $mode end up empty, the library existence check fails, and the format is rendered with the site-wide default theme instead of the one it is configured with.
A node edit form attaches the editor of every text format the user may use, so a single flat-configured format is enough to fill an unrelated form with these messages.
Steps to reproduce
- Enable Ace Editor and assign it as the text editor of a text format.
- Store that format's editor settings flat, as a recipe or a configuration import would:
drush php:eval '\Drupal\editor\Entity\Editor::load("full_html")->setSettings(["theme" => "chrome", "syntax" => "html"])->save();' - Visit any node edit form that offers that format.
Reproduced on Drupal 10.6.15 and Drupal 11.4.5, PHP 8.4.
Proposed resolution
Move the shape handling getJsSettings() already carries into a shared instanceSettings() helper, and read the theme and syntax through it in getLibraries(), so both shapes are normalised in one place and the two methods cannot drift apart again.
Kernel coverage is added for the libraries of both shapes, for the defaults of empty settings, and for the absence of any raised warning.
Screenshots
A node form offering a text format whose editor settings are stored flat, before and after the fix.

Remaining tasks
- ✅ File an issue
- ✅ Addition/Change/Update/Fix
- ✅ Testing to ensure no regression
- ✅ Automated unit/functional testing coverage
- ➖ Developer Documentation support
- ➖ User Guide Documentation support
- ➖ UX/UI designer responsibilities
- ➖ Accessibility and Readability
- ❌ Reviewed by a human
- ❌ Code review by maintainers
- ❌ Full testing and approval
- ❌ Credit contributors
- ❌ Review with the product owner
- ❌ Update Release Notes
- ❌ Release
User interface changes
- A text format configured with flat settings is rendered with its own theme and syntax instead of the site-wide defaults.
API changes
- N/A
Data model changes
- N/A
Release notes snippet
- Fixed the editor settings of a text format stored without the
fieldsetwrapper raising warnings and atrim()deprecation on every render, and the format being rendered with the default theme.
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | ace-fieldset-comparison.png | 258.52 KB | rajab natshah |
Issue fork ace_editor-3618848
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 #4
rajab natshahComment #5
rajab natshahAdded a before and after screenshot of a form offering a flat-configured text format.
Comment #6
rajab natshahComment #8
rajab natshah✅ Released ace_editor-2.0.4