Loading
Added support for Drupal 12: core version requirements, the contrib Toolbar...
Summary
Adds Drupal 12 support: ^10.3 || ^11 || ^12. Drupal 10.3 and above stay supported.
Issue: https://www.drupal.org/project/admin_toolbar/issues/3594696
Changes
Core compatibility
core_version_requirement: ^10.3 || ^11 || ^12in the info files of the 3 modules and the 5 test modules.admin_toolbar_links_access_filteris left as is: still a stub for one more minor, with itscore_version_requirementunchanged.hook_requirements()ofadmin_toolbar_links_access_filterno longer usesREQUIREMENT_ERROR(removed in Drupal 12). It uses theRequirementSeverityenum when it exists.
Composer
- Requires
drupal/toolbar(*), since the Toolbar module is no longer part of Drupal 12 core. - Removes the
provideentry fordrupal/toolbar.
Object oriented hooks
- Hooks are now
#[Hook]methods insrc/Hook/classes:AdminToolbarHooksAdminToolbarSearchHooksAdminToolbarToolsHooks
- The procedural implementations in the
.modulefiles are kept as#[LegacyHook]stubs calling the hook class services, so Drupal 10.3 keeps working. - The hook classes are registered as services in the
*.services.ymlfiles. This is required below Drupal 11.1. admin_toolbar_tools.menu_link_rebuild_manageris injected as a service closure, so it is only instantiated when needed.- Update hooks stay procedural.
Tests
#[Group]attributes added next to the@groupannotations. The annotations are kept because test discovery in core below 11.2 requires them.#[CoversClass]replaces@coversin the two unit tests.#[RunTestsInSeparateProcesses]added to the Kernel, Functional and FunctionalJavascript test classes (required by Drupal 12 core).- Mocks without expectations replaced with stubs (PHPUnit 12 notices).
AdminToolbarToolsExtraLinksTestenablescontactonly when the module is found (core below 12, or the contrib module), and skips thecontact_formchecks otherwise.
GitLab CI
- Opted in to the next major jobs (
OPT_IN_TEST_NEXT_MAJOR,RUN_JOB_UPGRADE_STATUS). - The "composer (next major)" job requires
drupal/automatic_updates,drupal/project_browseranddrupal/contact. Each is allowed to fail, and their tests are skipped when no compatible version exists. - The "phpstan (previous major)" job strips the attributes unavailable on Drupal 10 (
#[Group],#[Hook],#[LegacyHook], etc.) with twosedcommands.
Testing
- All GitLab CI jobs pass, including the next major (12.x) PHPUnit and PHPStan jobs and the previous major (10.6.x) PHPStan job.
- Tested locally on Drupal 11.5.
- The search autocomplete still relies on the jQuery UI autocomplete bundled in the core
drupal.autocompletelibrary, which is still present in coremain. The next major JavaScript tests pass. - Not tested manually on a Drupal 12 site.
Notes for the release
- Sites must have
drupal/toolbaravailable on Drupal 12 (Composer requires it).
Edited by David Suissa