public function SimplesitemapManager::getSitemapVariants in Simple XML sitemap 8.3
Parameters
string|null $sitemap_type:
bool $attach_type_info:
Return value
array
3 calls to SimplesitemapManager::getSitemapVariants()
File
- src/
SimplesitemapManager.php, line 136
Class
- SimplesitemapManager
- Class SimplesitemapManager @package Drupal\simple_sitemap
Namespace
Drupal\simple_sitemapCode
public function getSitemapVariants($sitemap_type = NULL, $attach_type_info = TRUE) {
if (NULL === $sitemap_type) {
$variants_by_type = [];
foreach ($this->configFactory
->listAll('simple_sitemap.variants.') as $config_name) {
$variants = !empty($variants = $this->configFactory
->get($config_name)
->get('variants')) ? $variants : [];
$variants = $attach_type_info ? $this
->attachSitemapTypeToVariants($variants, explode('.', $config_name)[2]) : $variants;
$variants_by_type[] = $variants;
}
$variants = array_merge([], ...$variants_by_type);
}
else {
$variants = !empty($variants = $this->configFactory
->get("simple_sitemap.variants.{$sitemap_type}")
->get('variants')) ? $variants : [];
$variants = $attach_type_info ? $this
->attachSitemapTypeToVariants($variants, $sitemap_type) : $variants;
}
// Sort variants by weight.
$variant_weights = array_column($variants, 'weight');
array_multisort($variant_weights, SORT_ASC, $variants);
return $variants;
}