public function Simplesitemap::getBundleSettings in Simple XML sitemap 8.2
Same name and namespace in other branches
- 8.3 src/Simplesitemap.php \Drupal\simple_sitemap\Simplesitemap::getBundleSettings()
Gets sitemap settings for an entity bundle, a non-bundle entity type or for all entity types and their bundles.
Parameters
string|null $entity_type_id: If set to null, sitemap settings for all entity types and their bundles are fetched.
string|null $bundle_name:
Return value
array|false Array of sitemap settings for an entity bundle, a non-bundle entity type or for all entity types and their bundles. False if entity type does not exist.
4 calls to Simplesitemap::getBundleSettings()
- Simplesitemap::bundleIsIndexed in src/
Simplesitemap.php - Checks if an entity bundle (or a non-bundle entity type) is set to be indexed in the sitemap settings.
- Simplesitemap::getEntityInstanceSettings in src/
Simplesitemap.php - Gets sitemap settings for an entity instance which overrides the sitemap settings of its bundle, or bundle settings, if they are not overridden.
- Simplesitemap::setBundleSettings in src/
Simplesitemap.php - Sets sitemap settings for a non-bundle entity type (e.g. user) or a bundle of an entity type (e.g. page).
- Simplesitemap::setEntityInstanceSettings in src/
Simplesitemap.php - Overrides entity bundle/entity type sitemap settings for a single entity.
File
- src/
Simplesitemap.php, line 452
Class
- Simplesitemap
- Class Simplesitemap @package Drupal\simple_sitemap
Namespace
Drupal\simple_sitemapCode
public function getBundleSettings($entity_type_id = NULL, $bundle_name = NULL) {
if (NULL !== $entity_type_id) {
$bundle_name = empty($bundle_name) ? $entity_type_id : $bundle_name;
$bundle_settings = $this->configFactory
->get("simple_sitemap.bundle_settings.{$entity_type_id}.{$bundle_name}")
->get();
return !empty($bundle_settings) ? $bundle_settings : FALSE;
}
else {
$config_names = $this->configFactory
->listAll('simple_sitemap.bundle_settings.');
$all_settings = [];
foreach ($config_names as $config_name) {
$config_name_parts = explode('.', $config_name);
$all_settings[$config_name_parts[2]][$config_name_parts[3]] = $this->configFactory
->get($config_name)
->get();
}
return $all_settings;
}
}