fix: #3402255 Stop double-escaping button labels in CKEditor 5

Description

Embed button labels with special characters (e.g. &) no longer show as HTML entities in CKEditor 5's toolbar tooltips. CKEditor 5 displays button labels as text, so the editor config now passes the label unescaped.

Closes https://git.drupalcode.org/project/entity_embed/-/work_items/3402255

  • DrupalEntity::getDynamicPluginConfig() passes each button's label unescaped; name stays escaped.
  • New DrupalEntityCKEditor5PluginTest covers both.
  • New CKEditor5IntegrationTest::testButtonLabelIsText() confirms a label containing HTML shows as text in the button and tooltip, and its script doesn't run.

The labels on the text format's toolbar settings page stay escaped (DrupalEntityDeriver): core's admin UI inserts them as HTML, so they already display correctly there.

Testing instructions

  1. Edit an embed button (e.g. "Node" at /admin/config/content/embed/button/manage/node) and set its label to Tom & Jerry.
  2. Edit content whose text format has that button in its CKEditor 5 toolbar.
  3. Hover over the button: the tooltip reads "Tom & Jerry". Before this change it read "Tom & Jerry".

AI disclosure

Claude Code (Claude Opus 5.5) reviewed the fix, wrote the kernel test and drafted this description. I wrote the original fix, confirmed the admin UI's labels must stay escaped, and ran the test locally against the old and new code.

🤖 Generated with Claude Code

Edited by Dave Reid

Merge request reports

Loading
Loading