public function Simplesitemap::disableEntityType in Simple XML sitemap 8.2
Same name and namespace in other branches
- 8.3 src/Simplesitemap.php \Drupal\simple_sitemap\Simplesitemap::disableEntityType()
Disables sitemap support for an entity type. Disabling support for an entity type deletes its sitemap settings permanently and removes sitemap settings from entity forms.
Parameters
string $entity_type_id: Entity type id like 'node'.
Return value
$this
File
- src/
Simplesitemap.php, line 334
Class
- Simplesitemap
- Class Simplesitemap @package Drupal\simple_sitemap
Namespace
Drupal\simple_sitemapCode
public function disableEntityType($entity_type_id) {
// Updating settings.
$enabled_entity_types = $this
->getSetting('enabled_entity_types');
if (FALSE !== ($key = array_search($entity_type_id, $enabled_entity_types))) {
unset($enabled_entity_types[$key]);
$this
->saveSetting('enabled_entity_types', array_values($enabled_entity_types));
}
// Deleting inclusion settings.
$config_names = $this->configFactory
->listAll("simple_sitemap.bundle_settings.{$entity_type_id}.");
foreach ($config_names as $config_name) {
$this->configFactory
->getEditable($config_name)
->delete();
}
// Deleting entity overrides.
$this
->removeEntityInstanceSettings($entity_type_id);
return $this;
}