diff --git a/src/Form/ConfigurationForm.php b/src/Form/ConfigurationForm.php index 8df5034..16ed24a 100644 --- a/src/Form/ConfigurationForm.php +++ b/src/Form/ConfigurationForm.php @@ -25,6 +25,13 @@ class ConfigurationForm extends ConfigFormBase { */ protected $manifest; + /** + * The system file config. + * + * @var \Drupal\Core\Config\ImmutableConfig + */ + protected $configSystemFile; + /** * Constructs a \Drupal\system\ConfigFormBase object. * @@ -35,6 +42,7 @@ class ConfigurationForm extends ConfigFormBase { parent::__construct($config_factory); $this->manifest = $manifest; + $this->configSystemFile = $config_factory->get('system.file'); } @@ -74,8 +82,8 @@ class ConfigurationForm extends ConfigFormBase { if (substr($files_path, 0, strlen($host)) == $host) { $files_path = str_replace($host, '', $files_path); } - $wrapper = \Drupal::service('stream_wrapper_manager')->getViaScheme(\Drupal::config('system.file')->get('default_scheme')); - $realpath = \Drupal::service('file_system')->realpath(\Drupal::config('system.file')->get('default_scheme') . "://"); + $wrapper = \Drupal::service('stream_wrapper_manager')->getViaScheme($this->configSystemFile->get('default_scheme')); + $realpath = \Drupal::service('file_system')->realpath($this->configSystemFile->get('default_scheme') . "://"); $config = $this->config('pwa.config'); @@ -401,7 +409,7 @@ class ConfigurationForm extends ConfigFormBase { $file_usage->add($file, 'PWA', 'PWA', $this->currentUser()->id()); // Save new image. - $wrapper = \Drupal::service('stream_wrapper_manager')->getViaScheme(\Drupal::config('system.file')->get('default_scheme')); + $wrapper = \Drupal::service('stream_wrapper_manager')->getViaScheme($this->configSystemFile->get('default_scheme')); $files_path = '/' . $wrapper->basePath() . '/pwa/'; $file_uri = $files_path . $file->getFilename();