Commit 967b5984 authored by thalles's avatar thalles Committed by pifagor

Issue #3015350 by thalles, alex_optim, voleger, pifagor: Drupal dependency...

Issue #3015350 by thalles, alex_optim, voleger, pifagor: Drupal dependency injection on XmlSitemapEntitiesSettingsForm
parent 46aaab3c
......@@ -11,6 +11,7 @@ use Drupal\Core\Entity\ContentEntityTypeInterface;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Url;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Drupal\Core\State\State;
/**
* Configure what entities will be included in sitemap.
......@@ -47,12 +48,15 @@ class XmlSitemapEntitiesSettingsForm extends ConfigFormBase implements Container
* The entity type manager.
* @param \Drupal\Core\Entity\EntityTypeBundleInfoInterface $entity_type_bundle_info
* The entity type bundle info.
* @param \Drupal\Core\State\State $state
* The object State.
*/
public function __construct(ConfigFactoryInterface $config_factory, EntityTypeManagerInterface $entity_type_manager, EntityTypeBundleInfoInterface $entity_type_bundle_info) {
public function __construct(ConfigFactoryInterface $config_factory, EntityTypeManagerInterface $entity_type_manager, EntityTypeBundleInfoInterface $entity_type_bundle_info, State $state) {
parent::__construct($config_factory);
$this->entityTypeManager = $entity_type_manager;
$this->entityTypeBundleInfo = $entity_type_bundle_info;
$this->state = $state;
}
/**
......@@ -62,7 +66,8 @@ class XmlSitemapEntitiesSettingsForm extends ConfigFormBase implements Container
return new static(
$container->get('config.factory'),
$container->get('entity_type.manager'),
$container->get('entity_type.bundle.info')
$container->get('entity_type.bundle.info'),
$container->get('state')
);
}
......@@ -201,7 +206,7 @@ class XmlSitemapEntitiesSettingsForm extends ConfigFormBase implements Container
}
}
}
\Drupal::state()->set('xmlsitemap_regenerate_needed', TRUE);
$this->state->set('xmlsitemap_regenerate_needed', TRUE);
parent::submitForm($form, $form_state);
}
......
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