protected function CustomUrlGenerator::processDataSet in Simple XML sitemap 4.x
Same name and namespace in other branches
- 8.3 src/Plugin/simple_sitemap/UrlGenerator/CustomUrlGenerator.php \Drupal\simple_sitemap\Plugin\simple_sitemap\UrlGenerator\CustomUrlGenerator::processDataSet()
- 8.2 src/Plugin/simple_sitemap/UrlGenerator/CustomUrlGenerator.php \Drupal\simple_sitemap\Plugin\simple_sitemap\UrlGenerator\CustomUrlGenerator::processDataSet()
@inheritdoc
Overrides UrlGeneratorBase::processDataSet
File
- src/
Plugin/ simple_sitemap/ UrlGenerator/ CustomUrlGenerator.php, line 117
Class
- CustomUrlGenerator
- Class CustomUrlGenerator
Namespace
Drupal\simple_sitemap\Plugin\simple_sitemap\UrlGeneratorCode
protected function processDataSet($data_set) : array {
if (!(bool) $this->pathValidator
->getUrlIfValidWithoutAccessCheck($data_set['path'])) {
$this->logger
->m(self::PATH_DOES_NOT_EXIST_MESSAGE, [
'@path' => $data_set['path'],
'@custom_paths_url' => $GLOBALS['base_url'] . '/admin/config/search/simplesitemap/custom',
])
->display('warning', 'administer sitemap settings')
->log('warning');
throw new SkipElementException();
}
$url_object = Url::fromUserInput($data_set['path'])
->setAbsolute();
$path = $url_object
->getInternalPath();
$entity = $this->entityHelper
->getEntityFromUrlObject($url_object);
$path_data = [
'url' => $url_object,
'lastmod' => !empty($entity) && method_exists($entity, 'getChangedTime') ? date('c', $entity
->getChangedTime()) : NULL,
'priority' => $data_set['priority'] ?? NULL,
'changefreq' => !empty($data_set['changefreq']) ? $data_set['changefreq'] : NULL,
'images' => $this->includeImages && !empty($entity) ? $this
->getEntityImageData($entity) : [],
'meta' => [
'path' => $path,
],
];
// Additional info useful in hooks.
if (!empty($entity)) {
$path_data['meta']['entity_info'] = [
'entity_type' => $entity
->getEntityTypeId(),
'id' => $entity
->id(),
];
}
return $path_data;
}