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 all editor.editor.* configs and strips the aickeditor and ai_balloon_menu toolbar items, as well as the ai_ckeditor_ai plugin configuration block.
  • hook_form_FORM_ID_alter() for system_modules_uninstall_confirm_form: Reads the pending modules from the expirable key-value store and, if ai_ckeditor is being uninstalled, injects a "Editor configurations that will be updated" details block listing the affected editor.editor.* configs — inserted before the confirmation prompt so administrators are informed before they confirm.

Testing instructions

  1. Install ai_ckeditor.
  2. Go to Configuration → Content authoring → Text formats and editors and edit a CKEditor 5 text format (e.g. Full HTML).
  3. Add the AI Balloon Menu button to the active toolbar and save.
  4. Go to Extend → Uninstall and select AI CKEditor integration.
  5. 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).
  6. Confirm the uninstall.
  7. Return to the text format configuration page — verify it loads correctly and no toolbar errors appear.
  8. Export config (drush config:export) and verify no ai_balloon_menu or aickeditor references remain in any editor.editor.*.yml file.

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

Merge request reports

Loading