Draft: fix: #3612598 Make the CKEditor 5 embed deriver and base plugin usable

Description

Closes #3612598

EmbedCKEditor5PluginBase can't be used today: its constructor reads $plugin_definition['embed_type_id'] from a CKEditor5PluginDefinition object, which isn't an array. The deriver loads buttons by a type property that doesn't exist, so it makes no derivatives. This fixes both and moves the editor configuration that each embed type module writes into the base class.

  • New EmbedCKEditor5PluginBase::getEmbedTypeId(): string (abstract, static): the embed type whose buttons the plugin provides. Replaces the embed_type_id definition property.
  • New EmbedCKEditor5PluginBase::getDynamicPluginConfig(): passes the buttons, text format, dialog settings and preview CSRF token to the editor.
  • New EmbedCKEditor5PluginBase::getDynamicPluginConfigKey(): string: the key the JavaScript plugin reads, the embed type ID by default.
  • New EmbedCKEditor5PluginBase::getDialogSettings(): array: the dialog's class, height and width.
  • getButton() returns an unescaped label and an icon key, as entity_embed's JavaScript expects.
  • EmbedCKEditor5PluginDeriver loads buttons by type_id, uses the button ID as the derivative ID, and replaces {{ embed_button_id }} and {{ embed_button_setting.<key> }} in the plugin's elements.
  • Kernel test, with a test plugin in embed_test.

Based on the earlier ckeditor5-follows sketch.

Remaining tasks

  • Move entity_embed onto the base class (issue to file; draft change ready).
  • Check the other projects that extend the base class (see AGENTS.md). Since its constructor always failed, none can be using it yet.

AI disclosure

Claude Code (Claude Opus 5.5) found this work in an old checkout with me, wrote the fix, the test plugin and the kernel test, and drafted this description. I chose the approach of moving the shared editor configuration into the base class, and reviewed the code. phpcs passes locally; the kernel test hasn't been run locally yet.

🤖 Generated with Claude Code

Merge request reports

Loading
Loading