You are here

protected function DefaultSitemapGenerator::addLinks in Simple XML sitemap 4.x

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

Adds URL elements to the sitemap.

Parameters

array $links:

1 call to DefaultSitemapGenerator::addLinks()
DefaultSitemapGenerator::getChunkXml in src/Plugin/simple_sitemap/SitemapGenerator/DefaultSitemapGenerator.php
Generates and returns a sitemap chunk.

File

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

Class

DefaultSitemapGenerator
Class DefaultSitemapGenerator

Namespace

Drupal\simple_sitemap\Plugin\simple_sitemap\SitemapGenerator

Code

protected function addLinks(array $links) : void {
  foreach ($links as $url_data) {
    $this->writer
      ->startElement('url');
    $this
      ->addUrl($url_data);
    $this->writer
      ->endElement();
  }
}