You are here

protected function UrlGeneratorBase::getAlternateUrlsForAllLanguages in Simple XML sitemap 8.2

1 call to UrlGeneratorBase::getAlternateUrlsForAllLanguages()
UrlGeneratorBase::addUrlVariants in src/Plugin/simple_sitemap/UrlGenerator/UrlGeneratorBase.php

File

src/Plugin/simple_sitemap/UrlGenerator/UrlGeneratorBase.php, line 281

Class

UrlGeneratorBase
Class UrlGeneratorBase @package Drupal\simple_sitemap\Plugin\simple_sitemap\UrlGenerator

Namespace

Drupal\simple_sitemap\Plugin\simple_sitemap\UrlGenerator

Code

protected function getAlternateUrlsForAllLanguages($url_object) {
  $alternate_urls = [];
  if ($url_object
    ->access($this->anonUser)) {
    foreach ($this->languages as $language) {
      if (!isset($this->batchSettings['excluded_languages'][$language
        ->getId()]) || $language
        ->isDefault()) {
        $url_object
          ->setOption('language', $language);
        $alternate_urls[$language
          ->getId()] = $this
          ->replaceBaseUrlWithCustom($url_object
          ->toString());
      }
    }
  }
  return $alternate_urls;
}