Change record status: 
Project: 
Introduced in branch: 
12.0.x
Introduced in version: 
12.0.0
Description: 

\Drupal\Core\Menu\MenuLinkTree::transform now takes a new argument that is used as a context. The context is used for contextual menu link tree manipulators to determine whether they should apply to the specific menu link tree instance.

Before:

$manipulators = [
  ['callable' => 'menu.default_tree_manipulators:checkAccess'],
];
$tree = $menu_tree->transform($tree, $manipulators);

After:

$manipulators = [
  ['callable' => 'menu.default_tree_manipulators:checkAccess'],
];
$tree = $menu_tree->transform($tree, $manipulators, $this);

Or if a static method is transforming the menu link tree:

$manipulators = [
  ['callable' => 'menu.default_tree_manipulators:checkAccess'],
];
$tree = $menu_tree->transform($tree, $manipulators, __METHOD__);

Also any classes implementing \Drupal\Core\Menu\MenuLinkTreeInterface will need to make the $context a required argument of ::transform in Drupal 12.0.

Impacts: 
Module developers