You are here

protected function EntityUrlGeneratorBase::getAlternateUrlsForAllLanguages in Simple XML sitemap 8.3

Same name and namespace in other branches
  1. 4.x src/Plugin/simple_sitemap/UrlGenerator/EntityUrlGeneratorBase.php \Drupal\simple_sitemap\Plugin\simple_sitemap\UrlGenerator\EntityUrlGeneratorBase::getAlternateUrlsForAllLanguages()

Parameters

\Drupal\Core\Url $url_object:

Return value

array

1 call to EntityUrlGeneratorBase::getAlternateUrlsForAllLanguages()
EntityUrlGeneratorBase::getUrlVariants in src/Plugin/simple_sitemap/UrlGenerator/EntityUrlGeneratorBase.php

File

src/Plugin/simple_sitemap/UrlGenerator/EntityUrlGeneratorBase.php, line 185

Class

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

Namespace

Drupal\simple_sitemap\Plugin\simple_sitemap\UrlGenerator

Code

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