From a04530f97f23d49d6098ca868b3dc9496b0c7ff9 Mon Sep 17 00:00:00 2001
From: James Glasgow <21148-jrglasgow@users.noreply.drupalcode.org>
Date: Fri, 25 Oct 2024 06:13:50 +0000
Subject: [PATCH] Issue #3430580: Automated Drupal 11 compatibility fixes for
 filefield_paths

---
 filefield_paths.info.yml                                  | 2 +-
 src/Form/SettingsForm.php                                 | 8 +++++---
 .../filefield_paths_test/filefield_paths_test.info.yml    | 1 +
 3 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/filefield_paths.info.yml b/filefield_paths.info.yml
index 62806e9..74ce9e1 100644
--- a/filefield_paths.info.yml
+++ b/filefield_paths.info.yml
@@ -2,7 +2,7 @@ name: 'File (Field) Paths'
 description: 'Adds improved Token based file sorting and renaming functionalities.'
 package: Fields
 configure: filefield_paths.admin_settings
-core_version_requirement: ^10.3
+core_version_requirement: ^10.3 || ^11
 type: module
 dependencies:
   - drupal:file
diff --git a/src/Form/SettingsForm.php b/src/Form/SettingsForm.php
index 005d5b7..b198e9f 100644
--- a/src/Form/SettingsForm.php
+++ b/src/Form/SettingsForm.php
@@ -10,6 +10,7 @@ use Drupal\Core\Form\FormStateInterface;
 use Drupal\Core\StreamWrapper\StreamWrapperManagerInterface;
 use Symfony\Component\DependencyInjection\ContainerInterface;
 use Symfony\Component\HttpFoundation\Request;
+use Drupal\Core\Config\TypedConfigManagerInterface;
 
 /**
  * Administration settings form for File (Field) Paths.
@@ -35,8 +36,8 @@ class SettingsForm extends ConfigFormBase {
   /**
    * {@inheritdoc}
    */
-  public function __construct(ConfigFactoryInterface $config_factory, StreamWrapperManagerInterface $stream_wrapper_manager, FileSystemInterface $file_system) {
-    parent::__construct($config_factory);
+  public function __construct(ConfigFactoryInterface $config_factory, StreamWrapperManagerInterface $stream_wrapper_manager, FileSystemInterface $file_system, TypedConfigManagerInterface $typed_configmanager) {
+    parent::__construct($config_factory, $typed_configmanager);
     $this->streamWrapperManager = $stream_wrapper_manager;
     $this->fileSystem = $file_system;
   }
@@ -48,7 +49,8 @@ class SettingsForm extends ConfigFormBase {
     return new static(
       $container->get('config.factory'),
       $container->get('stream_wrapper_manager'),
-      $container->get('file_system')
+      $container->get('file_system'),
+      $container->get('config.typed')
     );
   }
 
diff --git a/tests/modules/filefield_paths_test/filefield_paths_test.info.yml b/tests/modules/filefield_paths_test/filefield_paths_test.info.yml
index b554f55..55726af 100644
--- a/tests/modules/filefield_paths_test/filefield_paths_test.info.yml
+++ b/tests/modules/filefield_paths_test/filefield_paths_test.info.yml
@@ -2,6 +2,7 @@ name: 'File (Field) Paths tests'
 description: 'Support module for File (Field) Paths related testing.'
 package: Testing
 type: module
+core_version_requirement: ^10.3 || ^11.0
 dependencies:
   - filefield_paths:filefield_paths
   - drupal:file_test
-- 
GitLab