From 3a66d516df0debd1bc798c468bdb659b30b65c72 Mon Sep 17 00:00:00 2001
From: Vishal Khode <vishal.khode@acquia.com>
Date: Fri, 21 Jun 2024 19:19:40 +0530
Subject: [PATCH] ACMS-3441: Fixed the module installation error on Drupal Core
 10.3.0.

---
 .../cohesion_sync/cohesion_sync.services.yml   |  2 +-
 .../Import/SyncConfigImportSubscriber.php      | 18 ++++++++++++++++++
 2 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/modules/cohesion_sync/cohesion_sync.services.yml b/modules/cohesion_sync/cohesion_sync.services.yml
index 2d14b651a7..3d186f3535 100644
--- a/modules/cohesion_sync/cohesion_sync.services.yml
+++ b/modules/cohesion_sync/cohesion_sync.services.yml
@@ -14,7 +14,7 @@ services:
 
   cohesion_sync.config_import_subscriber.decorator:
     class: Drupal\cohesion_sync\EventSubscriber\Import\SyncConfigImportSubscriber
-    arguments: ['@theme_handler', '@extension.list.module']
+    arguments: ['@theme_handler', '@extension.list.theme' ,'@extension.list.module']
     decorates: config_import_subscriber
     decoration_priority: 5
     tags:
diff --git a/modules/cohesion_sync/src/EventSubscriber/Import/SyncConfigImportSubscriber.php b/modules/cohesion_sync/src/EventSubscriber/Import/SyncConfigImportSubscriber.php
index 7237cddce7..e309860661 100644
--- a/modules/cohesion_sync/src/EventSubscriber/Import/SyncConfigImportSubscriber.php
+++ b/modules/cohesion_sync/src/EventSubscriber/Import/SyncConfigImportSubscriber.php
@@ -3,14 +3,32 @@
 namespace Drupal\cohesion_sync\EventSubscriber\Import;
 
 use Drupal\cohesion_sync\SyncConfigImporter;
+use Drupal\Component\Utility\DeprecationHelper;
 use Drupal\Core\Config\ConfigImporter;
 use Drupal\Core\EventSubscriber\ConfigImportSubscriber;
+use Drupal\Core\Extension\ModuleExtensionList;
+use Drupal\Core\Extension\ThemeExtensionList;
+use Drupal\Core\Extension\ThemeHandlerInterface;
 
 /**
  * Config import subscriber for config import events.
  */
 class SyncConfigImportSubscriber extends ConfigImportSubscriber {
 
+  /**
+   * {@inheritdoc}
+   */
+  public function __construct(ThemeHandlerInterface $theme_handler, ThemeExtensionList $theme_extension_list, ModuleExtensionList $extension_list_module) {
+    // The config_import_subscriber service changed in Drupal Core 10.3.x.
+    // @see: https://www.drupal.org/project/drupal/issues/2942001
+    class_exists(DeprecationHelper::class) ? DeprecationHelper::backwardsCompatibleCall(
+      \Drupal::VERSION,
+      "10.3",
+      fn() => parent::__construct($theme_extension_list, $extension_list_module),
+      fn() => parent::__construct($theme_handler, $extension_list_module),
+    ): parent::__construct($theme_handler, $extension_list_module);
+  }
+
   /**
    * Validates configuration being imported does not have unmet dependencies.
    *