Skip to content
Snippets Groups Projects
Commit 50d837c9 authored by Eric Bremner's avatar Eric Bremner
Browse files

ISTWCMS-5753: fixing DI for csv content report

parent 8f850956
No related branches found
No related tags found
1 merge request!269Feature/istwcms 5753 ebremner csv content report
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
namespace Drupal\uw_cfg_common\Controller; namespace Drupal\uw_cfg_common\Controller;
use Drupal\Core\Config\ConfigFactory;
use Drupal\Core\Controller\ControllerBase; use Drupal\Core\Controller\ControllerBase;
use Drupal\Core\Entity\EntityTypeManagerInterface; use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\path_alias\AliasManager; use Drupal\path_alias\AliasManager;
...@@ -35,6 +36,13 @@ class UwDownloadCsvController extends ControllerBase { ...@@ -35,6 +36,13 @@ class UwDownloadCsvController extends ControllerBase {
*/ */
protected $sanitizeName; protected $sanitizeName;
/**
* The config factory.
*
* @var \Drupal\Core\Config\ConfigFactory
*/
protected $configFactory;
/** /**
* CSV Report constructor. * CSV Report constructor.
* *
...@@ -44,16 +52,20 @@ class UwDownloadCsvController extends ControllerBase { ...@@ -44,16 +52,20 @@ class UwDownloadCsvController extends ControllerBase {
* The path alias. * The path alias.
* @param Drupal\transliterate_filenames\SanitizeName $sanitizeName * @param Drupal\transliterate_filenames\SanitizeName $sanitizeName
* The sanitize name. * The sanitize name.
* @param Drupal\Core\Config\ConfigFactory $configFactory
* The config factory.
*/ */
public function __construct( public function __construct(
EntityTypeManagerInterface $entityTypeManager, EntityTypeManagerInterface $entityTypeManager,
AliasManager $pathAlias, AliasManager $pathAlias,
SanitizeName $sanitizeName SanitizeName $sanitizeName,
ConfigFactory $configFactory
) { ) {
$this->entityTypeManager = $entityTypeManager; $this->entityTypeManager = $entityTypeManager;
$this->pathAlias = $pathAlias; $this->pathAlias = $pathAlias;
$this->sanitizeName = $sanitizeName; $this->sanitizeName = $sanitizeName;
$this->configFactory = $configFactory;
} }
/** /**
...@@ -63,7 +75,8 @@ class UwDownloadCsvController extends ControllerBase { ...@@ -63,7 +75,8 @@ class UwDownloadCsvController extends ControllerBase {
return new static( return new static(
$container->get('entity_type.manager'), $container->get('entity_type.manager'),
$container->get('path_alias.manager'), $container->get('path_alias.manager'),
$container->get('transliterate_filenames.sanitize_name') $container->get('transliterate_filenames.sanitize_name'),
$container->get('config.factory')
); );
} }
...@@ -126,7 +139,7 @@ class UwDownloadCsvController extends ControllerBase { ...@@ -126,7 +139,7 @@ class UwDownloadCsvController extends ControllerBase {
$response = new Response($content); $response = new Response($content);
// Determine the filename for the CSV. // Determine the filename for the CSV.
$sitename = \Drupal::config('system.site')->get('name'); $sitename = $this->configFactory->get('system.site')->get('name');
$filename = $sitename . '_content_report.csv'; $filename = $sitename . '_content_report.csv';
// Make sure we are using a safe filename. // Make sure we are using a safe filename.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment