task: #3594544 Convert the hooks to the object-oriented pattern with legacy support
Issue: https://www.drupal.org/project/ace_editor/issues/3594544
Rebuilt the Project Update Bot's automated conversion (!25 (closed)) into a complete one:
- All procedural logic moved out of
ace_editor.module: the newAceEditorLibrariesservice owns library discovery,hook_library_info_build()andhook_library_info_alter()(with injectedfile_system, extension lists and config factory, and per-request caching of the resolved path), andsrc/Hook/AceEditorHooks.phpcarries the#[Hook]implementations. The bot converted onlyhook_help(). #[LegacyHook]wrappers stay in the.modulefile, so older cores and any caller oface_editor_lib_path()keep working.- Kept the bot's
RequirementSeverity/DeprecationHelperhandling and applied the same treatment to theREQUIREMENT_ERRORbranch it missed. - Fixed a latent bug along the way:
library_info_build()andlibrary_info_alter()used the discovered path without checking discovery succeeded, so a site without the Ace library gotscanDirectory(DRUPAL_ROOT . FALSE)and bogus asset paths. They now degrade cleanly. #[Group]attributes added to the existing test classes (PHPUnit 12 drops annotation-only groups).
Tests: new AceEditorLibrariesTest (services wired, discovery without the library, both library hooks, help text). Verified locally: kernel+unit suite 19 tests / 35 assertions green, PHPStan clean, PHPCS clean, the full local pipeline green (cspell, eslint, MkDocs, 12/12 functional scenarios), and the module installed on a fresh Drupal 11.4.5 site where the service resolves the library correctly.
AI-Generated: Yes
Checkpoints:
- File an issue
- Addition/Change/Update/Fix
- Testing to ensure no regression
- Automated unit testing coverage
- Automated functional testing coverage
-
UX/UI designer responsibilities - Readability
-
Accessibility - Performance
- Security
- Developer Documentation
-
User Guide Documentation - Reviewed by human
- Code review by maintainers
- Full testing and approval
- Credit contributors
- Review with the product owner
- Release notes snippet
- Release
Edited by Rajab Natshah