Problem/Motivation

From Drupal static service container documentation:

Generally, code in Drupal should accept its dependencies via either constructor injection or setter method injection. However, there are cases, particularly in legacy procedural code, where that is infeasible. This class acts as a unified global accessor to arbitrary services within the system in order to ease the transition from procedural code to injected OO code.

Proposed resolution

Where possible, replace calls to the Drupal static service container with injected calls. An example can be found in this intediff.

Comments

markdorison created an issue. See original summary.

adamzimmermann’s picture

Assigned: Unassigned » adamzimmermann
adamzimmermann’s picture

StatusFileSize
new58.22 KB

This fixes every use of the global \Drupal object that I could find. I am getting some errors while testing this, but they don't seem to be related to changes I made. If someone else could give this a spin that would be great. I believe some of the work that was recently done on the 7.x branch with regards to catching errors on signup pages will address some of the issues I was seeing when it is ported to the 8.x branch.

Either way, someone familiar with all of the functionality should test this out to make sure I didn't miss any details, as this touches a lot of code.

adamzimmermann’s picture

Status: Active » Needs review

markdorison’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.