protected function CustomUrlGenerator::processDataSet in Simple XML sitemap 8.3
Same name and namespace in other branches
- 8.2 src/Plugin/simple_sitemap/UrlGenerator/CustomUrlGenerator.php \Drupal\simple_sitemap\Plugin\simple_sitemap\UrlGenerator\CustomUrlGenerator::processDataSet()
- 4.x 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 106
Class
- CustomUrlGenerator
- Class CustomUrlGenerator @package Drupal\simple_sitemap\Plugin\simple_sitemap\UrlGenerator
Namespace
Drupal\simple_sitemap\Plugin\simple_sitemap\UrlGeneratorCode
protected function processDataSet($data_set) {
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');
return FALSE;
}
$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' => isset($data_set['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;
}