protected function EntityUrlGenerator::processDataSet in Simple XML sitemap 8.3
Same name and namespace in other branches
- 8.2 src/Plugin/simple_sitemap/UrlGenerator/EntityUrlGenerator.php \Drupal\simple_sitemap\Plugin\simple_sitemap\UrlGenerator\EntityUrlGenerator::processDataSet()
- 4.x src/Plugin/simple_sitemap/UrlGenerator/EntityUrlGenerator.php \Drupal\simple_sitemap\Plugin\simple_sitemap\UrlGenerator\EntityUrlGenerator::processDataSet()
@inheritdoc
Overrides UrlGeneratorBase::processDataSet
1 call to EntityUrlGenerator::processDataSet()
- EntityUrlGenerator::generate in src/
Plugin/ simple_sitemap/ UrlGenerator/ EntityUrlGenerator.php - @inheritdoc
File
- src/
Plugin/ simple_sitemap/ UrlGenerator/ EntityUrlGenerator.php, line 166
Class
- EntityUrlGenerator
- Class EntityUrlGenerator @package Drupal\simple_sitemap\Plugin\simple_sitemap\UrlGenerator
Namespace
Drupal\simple_sitemap\Plugin\simple_sitemap\UrlGeneratorCode
protected function processDataSet($data_set) {
$entities = $this->entityTypeManager
->getStorage($data_set['entity_type'])
->loadMultiple((array) $data_set['id']);
if (empty($entities)) {
return FALSE;
}
$paths = [];
foreach ($entities as $entity) {
$entity_settings = $this->generator
->setVariants($this->sitemapVariant)
->getEntityInstanceSettings($entity
->getEntityTypeId(), $entity
->id());
if (empty($entity_settings['index'])) {
continue;
}
$url_object = $entity
->toUrl()
->setAbsolute();
// Do not include external paths.
if (!$url_object
->isRouted()) {
continue;
}
$paths[] = [
'url' => $url_object,
'lastmod' => method_exists($entity, 'getChangedTime') ? date('c', $entity
->getChangedTime()) : NULL,
'priority' => isset($entity_settings['priority']) ? $entity_settings['priority'] : NULL,
'changefreq' => !empty($entity_settings['changefreq']) ? $entity_settings['changefreq'] : NULL,
'images' => !empty($entity_settings['include_images']) ? $this
->getEntityImageData($entity) : [],
// Additional info useful in hooks.
'meta' => [
'path' => $url_object
->getInternalPath(),
'entity_info' => [
'entity_type' => $entity
->getEntityTypeId(),
'id' => $entity
->id(),
],
],
];
}
return $paths;
}