fix(ai_ckeditor): remove stale toolbar items on uninstall and warn on confirm page
Description
Fixes an issue where uninstalling ai_ckeditor left stale toolbar references in existing editor.editor.* configuration entities, causing CKEditor 5 text format configuration pages to break.
Two changes in ai_ckeditor.install:
hook_module_preuninstall(): Before the module is removed, iterates over alleditor.editor.*configs and strips theaickeditorandai_balloon_menutoolbar items, as well as theai_ckeditor_aiplugin configuration block.hook_form_FORM_ID_alter()forsystem_modules_uninstall_confirm_form: Reads the pending modules from the expirable key-value store and, ifai_ckeditoris being uninstalled, injects a "Editor configurations that will be updated" details block listing the affectededitor.editor.*configs — inserted before the confirmation prompt so administrators are informed before they confirm.
Testing instructions
- Install
ai_ckeditor. - Go to Configuration → Content authoring → Text formats and editors and edit a CKEditor 5 text format (e.g. Full HTML).
- Add the AI Balloon Menu button to the active toolbar and save.
- Go to Extend → Uninstall and select AI CKEditor integration.
- On the confirmation page, verify that an "Editor configurations that will be updated" section lists the affected
editor.editor.*configs (e.g.editor.editor.full_html). - Confirm the uninstall.
- Return to the text format configuration page — verify it loads correctly and no toolbar errors appear.
- Export config (
drush config:export) and verify noai_balloon_menuoraickeditorreferences remain in anyeditor.editor.*.ymlfile.
Checklist
- I have linked the related issue in the MR title or
- I have performed a self-review of my own code
- I have added or updated tests, or explained in the description why this change is not covered by tests
- I have updated documentation for any new or changed functionality
- I have written testing instructions and verified them locally
- I have noted any required post-merge steps (config imports, cache rebuilds, manual changes)
- This MR contains no breaking API or hook changes, or they are explicitly documented in the description
AI Compliance
Note
Check the one that best describes your usage, or leave all unchecked if AI was not significantly used.
-
AI Assisted Code
Mainly written by a human; AI used for autocomplete orl human supervision. -
AI Generated Code
Mainly generated by AI, reviewed and approved by a human before this MR was created. -
Vibe Coded
_Generated by AI and only functionally reviewed before
Edited by Ricardo Castañeda