Loading
refactor: #3639285 Use OOP hooks and fix Drupal 11.3 deprecations
Description
Moves Entity Embed's hooks to an OOP hook class, now that 8.x-1.x requires Drupal 11.3, and fixes the Drupal 11.3 deprecations phpstan and the phpunit jobs report.
Issue: https://www.drupal.org/project/entity_embed/issues/3639285
- New
Drupal\entity_embed\Hook\EntityEmbedHookswith every hook fromentity_embed.module, excepthook_ckeditor4to5upgrade_plugin_info_alter(), which #3639510 removes. template_preprocess_entity_embed_container()is now aninitial preprocesscallback,EntityEmbedHooks::preprocessEntityEmbedContainer().entity_embed_filter_format_edit_form_validate()is nowEntityEmbedHooks::validateFilterFormatForm().FieldFormatterEntityEmbedDisplayBase::build()sets#printedinstead of calling the deprecatedshow().DrupalEntityDeriverkeeps the entity type manager instead of the embed button storage ($embedButtonStorageis removed).
Testing instructions
- Visit
/admin/help/entity_embed: the help page shows "About" and "Uses". - Embed a media item or node in a text field with an Entity Embed button and save: it renders as before.
- Edit the text format at
/admin/config/content/formats, enable "Align images", and move it below "Display embedded entities" in the filter order. Saving shows "The Display embedded entities filter needs to be placed after the Align images filter."
Remaining tasks
- Release note:
entity_embed_filter_format_edit_form_validate()andtemplate_preprocess_entity_embed_container()are removed; their code moved toEntityEmbedHooks.
AI disclosure
Claude Code (Claude Opus 5.5) moved the hooks into the new class, made the deprecation fixes and wrote this description. I chose to convert the hooks without #[LegacyHook] wrappers since 8.x-1.x requires Drupal 11.3, to leave the CKEditor 4 to 5 upgrade hook for #3639510, and I ran the kernel, functional and FunctionalJavascript tests, phpcs and phpstan locally.
Edited by Dave Reid