Update ContextMenuActiveTrail constructor for Drupal 11.2 compatibility

Created on 26 June 2025, about 1 month ago

Problem/Motivation

As of Drupal 11.2, the \Drupal\Core\Menu\MenuActiveTrail service has changed its constructor signature. It now includes a required $pathMatcher parameter (formerly optional), which breaks the current ContextMenuActiveTrail override in the Context module.

Steps to reproduce

  • Install Drupal 11.2.x
  • Enable the Context module (5.x branch)
  • Ensure the context module overrides the menu.active_trail service via ContextServiceProvider
  • Run drush cr or access any route that uses menu.active_trail
  • Observe the fatal TypeError

Proposed resolution

Update the ContextServiceProvider::alter() method to fully redefine the constructor arguments for the menu.active_trail service in the correct order, including both the context.manager and the new path.matcher dependency as expected by Core. And update the constructor of ContextMenuActiveTrail.

Remaining tasks

Apply the fix
Test on Drupal 11.2+
Merge and tag a release

🐛 Bug report
Status

Active

Version

5.0

Component

Code

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024