public function EntityUrlGenerator::generate in Simple XML sitemap 4.x
Same name and namespace in other branches
- 8.3 src/Plugin/simple_sitemap/UrlGenerator/EntityUrlGenerator.php \Drupal\simple_sitemap\Plugin\simple_sitemap\UrlGenerator\EntityUrlGenerator::generate()
@inheritdoc
Overrides EntityUrlGeneratorBase::generate
File
- src/
Plugin/ simple_sitemap/ UrlGenerator/ EntityUrlGenerator.php, line 249
Class
- EntityUrlGenerator
- Class EntityUrlGenerator
Namespace
Drupal\simple_sitemap\Plugin\simple_sitemap\UrlGeneratorCode
public function generate($data_set) : array {
$path_data_sets = $this
->processDataSet($data_set);
$url_variant_sets = [];
foreach ($path_data_sets as $path_data) {
if (isset($path_data['url']) && $path_data['url'] instanceof Url) {
$url_object = $path_data['url'];
unset($path_data['url']);
$url_variant_sets[] = $this
->getUrlVariants($path_data, $url_object);
}
}
// Make sure to clear entity memory cache so it does not build up resulting
// in a constant increase of memory.
// See https://www.drupal.org/project/simple_sitemap/issues/3170261 and
// https://www.drupal.org/project/simple_sitemap/issues/3202233
if ($this->entityTypeManager
->getDefinition($data_set['entity_type'])
->isStaticallyCacheable()) {
$this->entityMemoryCache
->deleteAll();
}
return array_merge([], ...$url_variant_sets);
}