Commit 27657785 authored by gbyte.co's avatar gbyte.co

Clean up services file and ensure no services are getting called anymore but injected

parent d4888794
services:
simple_sitemap.generator:
class: Drupal\simple_sitemap\Simplesitemap
arguments: ['@simple_sitemap.sitemap_generator', '@config.factory', '@database', '@entity_type.manager', '@path.validator']
public: true
arguments:
- @simple_sitemap.sitemap_generator
- @config.factory
- @database
- @entity_type.manager
- @path.validator
- @date.formatter
simple_sitemap.sitemap_generator:
class: Drupal\simple_sitemap\SitemapGenerator
arguments: ['@simple_sitemap.batch', '@database', '@module_handler', '@language_manager']
public: false
arguments:
- @simple_sitemap.batch
- @database
- @module_handler
- @language_manager
simple_sitemap.form:
class: Drupal\simple_sitemap\Form\Form
arguments: ['@simple_sitemap.generator', '@current_user']
public: true
arguments:
- @simple_sitemap.generator
- @current_user
simple_sitemap.batch:
class: Drupal\simple_sitemap\Batch\Batch
public: false
simple_sitemap.batch_url_generator:
class: Drupal\simple_sitemap\Batch\BatchUrlGenerator
arguments: ['@simple_sitemap.sitemap_generator', '@language_manager', '@entity_type.manager', '@path.validator', '@entity.query']
public: true
arguments:
- @simple_sitemap.sitemap_generator
- @language_manager
- @entity_type.manager
- @path.validator
- @entity.query
......@@ -23,23 +23,27 @@ class Simplesitemap {
/**
* Simplesitemap constructor.
*
* @param $sitemapGenerator
* @param \Drupal\Core\Config\ConfigFactoryInterface $configFactoryInterface
* @param \Drupal\Core\Database\Database $database
* @param $database
* @param \Drupal\Core\Entity\EntityTypeManager $entityTypeManager
* @param $pathValidator
* @param $dateFormatter
*/
public function __construct(
$sitemapGenerator,
\Drupal\Core\Config\ConfigFactoryInterface $configFactoryInterface,
$database,
\Drupal\Core\Entity\EntityTypeManager $entityTypeManager,
$pathValidator
$pathValidator,
$dateFormatter
) {
$this->sitemapGenerator = $sitemapGenerator;
$this->configFactory = $configFactoryInterface;
$this->db = $database;
$this->entityTypeManager = $entityTypeManager;
$this->pathValidator = $pathValidator;
$this->dateFormatter = $dateFormatter;
}
/**
......@@ -442,7 +446,7 @@ class Simplesitemap {
public function getGeneratedAgo() {
$chunks = $this->fetchSitemapChunks();
if (isset($chunks[1]->sitemap_created)) {
return \Drupal::service('date.formatter')
return $this->dateFormatter
->formatInterval(REQUEST_TIME - $chunks[1]->sitemap_created);
}
return FALSE;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment