From the archive! Drupal 9: Extending Drupal Base Classes Without Overriding Constructors
This article details a technique for injecting dependencies into constructors, forms, and plugins without needing to override the constructor.
We break down how to use dependency injection and what the technique does to improve this in Drupal.
Despite the article being written for Drupal 9, the technique is still relevant in Drupal 11.
https://www.hashbangcode.com/article/drupal-9-extending-drupal-base-classes-without-overriding-constructors
#drupal #drupalDevelopment #hashbangcode

Drupal 9: Extending Drupal Base Classes Without Overriding Constructors
I have been using the Drupal dependency injection system for a while now, even giving talks and writing articles on the subject. As the release of Drupal 10 is just around the corner I have been thinking more about how to override dependencies to plugin classes.








