From b27095e3c8fb6ac7c8fe5a452850e45ca5dd1c79 Mon Sep 17 00:00:00 2001
From: Liam Morland <liam@openplus.ca>
Date: Sat, 31 Aug 2024 13:57:10 -0400
Subject: [PATCH] Issue #3274842: Remove unnecessary dependency injection of
 ModuleHandler

Use the version from ControllerBase.

This reverts commit 63096c7b76bce0311c26af71683e476fc477bd4c.
This reverts commit 3da83a059c7b248ddee5adb5fce690a1dd1f6cec.
---
 src/Controller/HandlePdfController.php | 15 +--------------
 1 file changed, 1 insertion(+), 14 deletions(-)

diff --git a/src/Controller/HandlePdfController.php b/src/Controller/HandlePdfController.php
index 96a535f..7a04d72 100644
--- a/src/Controller/HandlePdfController.php
+++ b/src/Controller/HandlePdfController.php
@@ -4,7 +4,6 @@ namespace Drupal\fillpdf\Controller;
 
 use Drupal\Core\Config\ConfigFactoryInterface;
 use Drupal\Core\Controller\ControllerBase;
-use Drupal\Core\Extension\ModuleHandlerInterface;
 use Drupal\Core\Link;
 use Drupal\Core\StreamWrapper\StreamWrapperInterface;
 use Drupal\Core\StreamWrapper\StreamWrapperManagerInterface;
@@ -89,13 +88,6 @@ class HandlePdfController extends ControllerBase {
    */
   protected $configFactory;
 
-  /**
-   * The module handler service.
-   *
-   * @var \Drupal\Core\Extension\ModuleHandlerInterface
-   */
-  protected $moduleHandler;
-
   /**
    * Constructs a FillPdfBackendManager object.
    *
@@ -117,8 +109,6 @@ class HandlePdfController extends ControllerBase {
    *   Provides a StreamWrapper manager.
    * @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
    *   The configuration factory.
-   * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
-   *   The module handler service.
    */
   public function __construct(
     FillPdfLinkManipulatorInterface $link_manipulator,
@@ -130,7 +120,6 @@ class HandlePdfController extends ControllerBase {
     BackendProxyInterface $backend_proxy,
     StreamWrapperManagerInterface $stream_wrapper_manager,
     ConfigFactoryInterface $config_factory,
-    ModuleHandlerInterface $module_handler,
   ) {
     $this->linkManipulator = $link_manipulator;
     $this->contextManager = $context_manager;
@@ -141,7 +130,6 @@ class HandlePdfController extends ControllerBase {
     $this->backendProxy = $backend_proxy;
     $this->streamWrapperManager = $stream_wrapper_manager;
     $this->configFactory = $config_factory;
-    $this->moduleHandler = $module_handler;
   }
 
   /**
@@ -158,7 +146,6 @@ class HandlePdfController extends ControllerBase {
       $container->get('fillpdf.backend_proxy'),
       $container->get('stream_wrapper_manager'),
       $container->get('config.factory'),
-      $container->get('module_handler')
     );
   }
 
@@ -171,7 +158,7 @@ class HandlePdfController extends ControllerBase {
    *   The FillPDF context to alter.
    */
   public function alterContext(array &$context): void {
-    $this->moduleHandler->alter('fillpdf_populate_pdf_context', $context);
+    $this->moduleHandler()->alter('fillpdf_populate_pdf_context', $context);
   }
 
   /**
-- 
GitLab