Commit 1c231627 authored by gbyte.co's avatar gbyte.co

Clean up

parent cc2a5dea
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
* Main module file containing hooks. * Main module file containing hooks.
*/ */
use \Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Routing\RouteMatchInterface; use Drupal\Core\Routing\RouteMatchInterface;
use Drupal\system\MenuInterface; use Drupal\system\MenuInterface;
...@@ -22,7 +23,7 @@ function simple_sitemap_help($route_name, RouteMatchInterface $route_match) { ...@@ -22,7 +23,7 @@ function simple_sitemap_help($route_name, RouteMatchInterface $route_match) {
* *
* Adds sitemap settings to entity types that are supported via plugins. * Adds sitemap settings to entity types that are supported via plugins.
*/ */
function simple_sitemap_form_alter(&$form, $form_state, $form_id) { function simple_sitemap_form_alter(&$form, FormStateInterface $form_state, $form_id) {
$f = \Drupal::service('simple_sitemap.form_helper')->processForm($form_state); $f = \Drupal::service('simple_sitemap.form_helper')->processForm($form_state);
if (!$f->alteringForm) { if (!$f->alteringForm) {
...@@ -68,7 +69,7 @@ function simple_sitemap_form_alter(&$form, $form_state, $form_id) { ...@@ -68,7 +69,7 @@ function simple_sitemap_form_alter(&$form, $form_state, $form_id) {
/** /**
* Form submission handler called in hook_form_alter. * Form submission handler called in hook_form_alter.
*/ */
function simple_sitemap_entity_form_submit($form, &$form_state) { function simple_sitemap_entity_form_submit($form, FormStateInterface &$form_state) {
$f = \Drupal::service('simple_sitemap.form_helper')->processForm($form_state); $f = \Drupal::service('simple_sitemap.form_helper')->processForm($form_state);
......
...@@ -51,7 +51,7 @@ class SimplesitemapController extends ControllerBase { ...@@ -51,7 +51,7 @@ class SimplesitemapController extends ControllerBase {
throw new NotFoundHttpException(); throw new NotFoundHttpException();
} }
// Display sitemap with correct xml header. // Display sitemap with correct XML header.
$response = new CacheableResponse($output, Response::HTTP_OK, ['content-type' => 'application/xml']); $response = new CacheableResponse($output, Response::HTTP_OK, ['content-type' => 'application/xml']);
$meta_data = $response->getCacheableMetadata(); $meta_data = $response->getCacheableMetadata();
$meta_data->addCacheTags(['simple_sitemap']); $meta_data->addCacheTags(['simple_sitemap']);
......
...@@ -4,6 +4,8 @@ namespace Drupal\simple_sitemap\Form; ...@@ -4,6 +4,8 @@ namespace Drupal\simple_sitemap\Form;
use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\ContainerInterface;
use Drupal\Core\Form\ConfigFormBase; use Drupal\Core\Form\ConfigFormBase;
use Drupal\simple_sitemap\Simplesitemap;
use Drupal\Core\Path\PathValidator;
/** /**
* Class SimplesitemapFormBase. * Class SimplesitemapFormBase.
...@@ -19,11 +21,15 @@ abstract class SimplesitemapFormBase extends ConfigFormBase { ...@@ -19,11 +21,15 @@ abstract class SimplesitemapFormBase extends ConfigFormBase {
/** /**
* SimplesitemapFormBase constructor. * SimplesitemapFormBase constructor.
* *
* @param \Drupal\Core\Config\ConfigFactoryInterface $generator * @param \Drupal\simple_sitemap\Simplesitemap $generator
* @param $form_helper * @param \Drupal\simple_sitemap\Form\FormHelper $form_helper
* @param $path_validator * @param \Drupal\Core\Path\PathValidator $path_validator
*/ */
public function __construct($generator, $form_helper, $path_validator) { public function __construct(
Simplesitemap $generator,
FormHelper $form_helper,
PathValidator $path_validator
) {
$this->generator = $generator; $this->generator = $generator;
$this->formHelper = $form_helper; $this->formHelper = $form_helper;
$this->pathValidator = $path_validator; $this->pathValidator = $path_validator;
......
...@@ -7,6 +7,9 @@ use Drupal\simple_sitemap\Form\FormHelper; ...@@ -7,6 +7,9 @@ use Drupal\simple_sitemap\Form\FormHelper;
use Drupal\Core\Database\Connection; use Drupal\Core\Database\Connection;
use Drupal\Core\Entity\EntityTypeManagerInterface; use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Path\PathValidator; use Drupal\Core\Path\PathValidator;
use Drupal\Core\Entity\Query\QueryFactory;
use Drupal\Core\Config\ConfigFactory;
use Drupal\Core\Datetime\DateFormatter;
/** /**
* Class Simplesitemap. * Class Simplesitemap.
...@@ -30,7 +33,7 @@ class Simplesitemap { ...@@ -30,7 +33,7 @@ class Simplesitemap {
* Simplesitemap constructor. * Simplesitemap constructor.
* *
* @param $sitemapGenerator * @param $sitemapGenerator
* @param $configFactoryInterface * @param $configFactory
* @param $database * @param $database
* @param $entityQuery * @param $entityQuery
* @param $entityTypeManager * @param $entityTypeManager
...@@ -39,15 +42,15 @@ class Simplesitemap { ...@@ -39,15 +42,15 @@ class Simplesitemap {
*/ */
public function __construct( public function __construct(
SitemapGenerator $sitemapGenerator, SitemapGenerator $sitemapGenerator,
$configFactoryInterface, ConfigFactory $configFactory,
Connection $database, Connection $database,
$entityQuery, QueryFactory $entityQuery,
EntityTypeManagerInterface $entityTypeManager, EntityTypeManagerInterface $entityTypeManager,
PathValidator $pathValidator, PathValidator $pathValidator,
$dateFormatter DateFormatter $dateFormatter
) { ) {
$this->sitemapGenerator = $sitemapGenerator; $this->sitemapGenerator = $sitemapGenerator;
$this->configFactory = $configFactoryInterface; $this->configFactory = $configFactory;
$this->db = $database; $this->db = $database;
$this->entityQuery = $entityQuery; $this->entityQuery = $entityQuery;
$this->entityTypeManager = $entityTypeManager; $this->entityTypeManager = $entityTypeManager;
......
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