feat(ai_ckeditor): warn users when no AI provider is installed in the CKEditor settings tab

Description

Improves the UX of ai_ckeditor when no AI provider module is installed.

Currently, the "AI tools" tab in the CKEditor text format configuration (/admin/config/content/formats/manage/*) renders the full plugin settings form even when no provider is available, giving no feedback to the user about why the feature will not work. New users who install ai_ckeditor without first setting up a provider are left confused.

This MR adds a guard in AiCKEditor::buildConfigurationForm() that detects when AiProviderPluginManager::getDefinitions() returns empty — the same check used by ProviderSetupList on /admin/config/ai/providers — and replaces the form with a descriptive message linking to:

  1. The provider module matrix (external docs) to install a provider.
  2. /admin/config/ai/providers to configure it once installed.

Testing instructions

Testing Setup:

mkdir my-drupal-site && cd my-drupal-site ddev config --project-type=drupal11 --docroot=web ddev composer create-project drupal/cms ddev drush site:install --account-name=admin --account-pass=admin -y ddev composer require drupal/ai ddev drush en ai ai_ckeditor -y ddev launch $(ddev drush uli /admin/config/content/formats/manage/full_html)

Verify warning when no provider is installed:

  1. With no AI provider module enabled, open a text format configuration page (e.g. /admin/config/content/formats/manage/full_html).
  2. Drag the AI Stars widget into the active toolbar and save.
  3. Re-open the text format configuration and open the AI tools tab under "CKEditor 5 plugin settings".
  4. Confirm the tab shows the message: "No AI provider is installed. To use this feature, first install a provider module, then configure it." with the two expected links, and that no plugin fields are rendered.

Verify normal form when a provider is installed:

  1. Enable an AI provider module (e.g. ai_openai or ai_anthropic).
  2. Return to the same text format configuration page and open AI tools.
  3. Confirm the full plugin settings form renders as usual.

Checklist

  • I have linked the related issue in the MR title or description
  • 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 or partial generation under full 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 this MR was created.

Closes #3586549

Edited by Ricardo Castañeda

Merge request reports

Loading