Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
public function __construct($root, \Twig_LoaderInterface $loader = NULL, $options = array()) {
// @todo Pass as arguments from the DIC.
$this->cache_object = \Drupal::cache();
Proposed resolution
Inject it
Remaining tasks
User interface changes
API changes
Data model changes
Beta phase evaluation
Issue category | Task because this is a code improvement. |
---|---|
Issue priority | Normal because is a code cleanup that improves the testability of the class. |
Disruption | Really unlikely disruption, as someone would have to override the TwigEnvironment class. |
Comment | File | Size | Author |
---|---|---|---|
#1 | inject_the_cache_bin-2539258-1.patch | 1.86 KB | cilefen |
|
Comments
Comment #1
cilefen CreditAttribution: cilefen commentedComment #2
dawehnerPerfect
Comment #3
alexpottA normal task without a beta evaluation can't be committed. I know it feels like busy-work but if we don't apply the policy to all issues then it is perceived to be unfair.
Comment #4
cilefen CreditAttribution: cilefen commentedI'm not sure about the contrib disruption.
Comment #5
dawehnerUpdated the contrib disruption.
Comment #6
alexpottI agree that extending TwigEnvironment atm would be close to 0 and having non injected code in core encourages others to do it when we really want injected services everywhere. Let's do this. Committed be3b533 and pushed to 8.0.x. Thanks!