Problem/Motivation

Multiple times in #1869638: Make the menu shown in the administration menu tray configurable, different reviewers (myself included) got confused about both preRenderAdministrationTray() and preRenderGetRenderedSubtrees() being public static methods.

We believe this is no longer a technical requirement, since trusted callbacks should be able to instantiate the class and call regular members.

However, refactoring everything to avoid the static is definitely out of scope over there.

Steps to reproduce

Closely look at the source code in core/modules/toolbar/src/Controller/ToolbarController.php

Proposed resolution

  • Make preRenderAdministrationTray() and preRenderGetRenderedSubtrees() regular public methods on ToolbarController.
  • Convert the places they're registered as pre render callbacks to do the instance-based-thing.
  • Convert the helper methods added in #1869638, getAdminTrayMenuName() and getAdminTrayMenuTree() from public static (but @internal) to protected methods.
  • Remove \Drupal::service usages and properly inject the toolbar.menu_tree service into ToolbarController.

Remaining tasks

  1. Do it.
  2. Ensure tests are still passing and happy.
  3. Reviews / refinements.
  4. RTBC.
  5. Commit.

User interface changes

Nope.

API changes

Nothing public (really). Only changes to @internal methods.

Data model changes

Nope.

Release notes snippet

N/A.

Comments

dww created an issue. See original summary.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.

quietone’s picture

Status: Active » Postponed

The Toolbar Module was approved for removal in #3476882: [Policy] Move Toolbar module to contrib.

This is Postponed. The status is set according to two policies. The Remove a core extension and move it to a contributed project and the Extensions approved for removal policies.

The deprecation work is in #3484850: [meta] Tasks to deprecate Toolbar module and the removal work in #3488828: [meta] Tasks to remove Toolbar module.

Toolbar will be moved to a contributed project before Drupal 12.0.0 is released.

quietone’s picture

Project: Drupal core » Toolbar
Version: main » 1.x-dev
Component: toolbar.module » Code
Status: Postponed » Active

The Toolbar module have moved from core to contrib.