public function EntityMenuLinkContentUrlGenerator::getDataSets in Simple XML sitemap 4.x
Same name and namespace in other branches
- 8.3 src/Plugin/simple_sitemap/UrlGenerator/EntityMenuLinkContentUrlGenerator.php \Drupal\simple_sitemap\Plugin\simple_sitemap\UrlGenerator\EntityMenuLinkContentUrlGenerator::getDataSets()
- 8.2 src/Plugin/simple_sitemap/UrlGenerator/EntityMenuLinkContentUrlGenerator.php \Drupal\simple_sitemap\Plugin\simple_sitemap\UrlGenerator\EntityMenuLinkContentUrlGenerator::getDataSets()
@inheritdoc
Overrides UrlGeneratorBase::getDataSets
File
- src/
Plugin/ simple_sitemap/ UrlGenerator/ EntityMenuLinkContentUrlGenerator.php, line 106
Class
- EntityMenuLinkContentUrlGenerator
- Class EntityMenuLinkContentUrlGenerator
Namespace
Drupal\simple_sitemap\Plugin\simple_sitemap\UrlGeneratorCode
public function getDataSets() : array {
$data_sets = [];
$bundle_settings = $this->entitiesManager
->setVariants($this->sitemapVariant
->id())
->getBundleSettings();
if (!empty($bundle_settings['menu_link_content'])) {
foreach ($bundle_settings['menu_link_content'] as $bundle_name => $bundle_settings) {
if ($bundle_settings['index']) {
// Retrieve the expanded tree.
$tree = $this->menuLinkTree
->load($bundle_name, new MenuTreeParameters());
$tree = $this->menuLinkTree
->transform($tree, [
[
'callable' => 'menu.default_tree_manipulators:generateIndexAndSort',
],
[
'callable' => 'menu.default_tree_manipulators:flatten',
],
]);
foreach ($tree as $item) {
$data_sets[] = $item->link;
}
}
}
}
return $data_sets;
}