protected function EntityUrlGeneratorBase::getAlternateUrlsForTranslatedLanguages in Simple XML sitemap 8.3
Same name and namespace in other branches
- 4.x src/Plugin/simple_sitemap/UrlGenerator/EntityUrlGeneratorBase.php \Drupal\simple_sitemap\Plugin\simple_sitemap\UrlGenerator\EntityUrlGeneratorBase::getAlternateUrlsForTranslatedLanguages()
Parameters
\Drupal\Core\Entity\ContentEntityInterface $entity:
\Drupal\Core\Url $url_object:
Return value
array
1 call to EntityUrlGeneratorBase::getAlternateUrlsForTranslatedLanguages()
- EntityUrlGeneratorBase::getUrlVariants in src/
Plugin/ simple_sitemap/ UrlGenerator/ EntityUrlGeneratorBase.php
File
- src/
Plugin/ simple_sitemap/ UrlGenerator/ EntityUrlGeneratorBase.php, line 164
Class
- EntityUrlGeneratorBase
- Class EntityUrlGeneratorBase @package Drupal\simple_sitemap\Plugin\simple_sitemap\UrlGenerator
Namespace
Drupal\simple_sitemap\Plugin\simple_sitemap\UrlGeneratorCode
protected function getAlternateUrlsForTranslatedLanguages(ContentEntityInterface $entity, Url $url_object) {
$alternate_urls = [];
/** @var Language $language */
foreach ($entity
->getTranslationLanguages() as $language) {
if (!isset($this->settings['excluded_languages'][$language
->getId()]) || $language
->isDefault()) {
if ($entity
->getTranslation($language
->getId())
->access('view', $this->anonUser)) {
$alternate_urls[$language
->getId()] = $this
->replaceBaseUrlWithCustom($url_object
->setAbsolute()
->setOption('language', $language)
->toString());
}
}
}
return $alternate_urls;
}