Unverified Commit cd19176a authored by Dave Reid's avatar Dave Reid Committed by Dave Reid

Issue #3072108 by leymannx, Dave Reid: FatalThrowableError accessing entity...

Issue #3072108 by leymannx, Dave Reid: FatalThrowableError accessing entity settings form due to typehinting on State rather than StateInterface.
parent 3f6afe74
......@@ -6,17 +6,16 @@ use Drupal\Core\Entity\EntityTypeBundleInfoInterface;
use Drupal\Core\Form\ConfigFormBase;
use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\DependencyInjection\ContainerInjectionInterface;
use Drupal\Core\Entity\ContentEntityTypeInterface;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Url;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Drupal\Core\State\State;
use Drupal\Core\State\StateInterface;
/**
* Configure what entities will be included in sitemap.
*/
class XmlSitemapEntitiesSettingsForm extends ConfigFormBase implements ContainerInjectionInterface {
class XmlSitemapEntitiesSettingsForm extends ConfigFormBase {
/**
* The entity type manager.
......@@ -32,6 +31,13 @@ class XmlSitemapEntitiesSettingsForm extends ConfigFormBase implements Container
*/
protected $entityTypeBundleInfo;
/**
* The state.
*
* @var \Drupal\Core\State\StateInterface
*/
protected $state;
/**
* {@inheritdoc}
*/
......@@ -48,10 +54,10 @@ 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
* @param \Drupal\Core\State\StateInterface $state
* The object State.
*/
public function __construct(ConfigFactoryInterface $config_factory, EntityTypeManagerInterface $entity_type_manager, EntityTypeBundleInfoInterface $entity_type_bundle_info, State $state) {
public function __construct(ConfigFactoryInterface $config_factory, EntityTypeManagerInterface $entity_type_manager, EntityTypeBundleInfoInterface $entity_type_bundle_info, StateInterface $state) {
parent::__construct($config_factory);
$this->entityTypeManager = $entity_type_manager;
......@@ -97,9 +103,7 @@ class XmlSitemapEntitiesSettingsForm extends ConfigFormBase implements Container
asort($labels);
$form = [
'#labels' => $labels,
];
$form['#labels'] = $labels;
$form['entity_types'] = [
'#title' => $this->t('Custom sitemap entities settings'),
......@@ -193,10 +197,8 @@ class XmlSitemapEntitiesSettingsForm extends ConfigFormBase implements Container
if (!$values['settings'][$key]['types'][$bundle_key]) {
xmlsitemap_link_bundle_delete($key, $bundle_key, TRUE);
}
else {
if (!xmlsitemap_link_bundle_check_enabled($key, $bundle_key)) {
xmlsitemap_link_bundle_enable($key, $bundle_key);
}
else if (!xmlsitemap_link_bundle_check_enabled($key, $bundle_key)) {
xmlsitemap_link_bundle_enable($key, $bundle_key);
}
}
}
......
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