You are here

protected function DefaultSitemapGenerator::addAlternateUrls in Simple XML sitemap 8.3

Same name and namespace in other branches
  1. 4.x src/Plugin/simple_sitemap/SitemapGenerator/DefaultSitemapGenerator.php \Drupal\simple_sitemap\Plugin\simple_sitemap\SitemapGenerator\DefaultSitemapGenerator::addAlternateUrls()

Adds all translation variant URLs as alternate URLs to a URL.

Parameters

array $alternate_urls:

1 call to DefaultSitemapGenerator::addAlternateUrls()
DefaultSitemapGenerator::addUrl in src/Plugin/simple_sitemap/SitemapGenerator/DefaultSitemapGenerator.php
Adds a URL element to the sitemap.

File

src/Plugin/simple_sitemap/SitemapGenerator/DefaultSitemapGenerator.php, line 143

Class

DefaultSitemapGenerator
Class DefaultSitemapGenerator @package Drupal\simple_sitemap\Plugin\simple_sitemap\SitemapGenerator

Namespace

Drupal\simple_sitemap\Plugin\simple_sitemap\SitemapGenerator

Code

protected function addAlternateUrls(array $alternate_urls) {
  foreach ($alternate_urls as $language_id => $alternate_url) {
    $this->writer
      ->startElement('xhtml:link');
    $this
      ->addAlternateUrl($language_id, $alternate_url);
    $this->writer
      ->endElement();
  }
}