public function DefaultSitemapGenerator::getChunkXml in Simple XML sitemap 4.x
Generates and returns a sitemap chunk.
Parameters
array $links: All links with their multilingual versions and settings.
Return value
string Sitemap chunk
Overrides SitemapGeneratorBase::getChunkXml
File
- src/
Plugin/ simple_sitemap/ SitemapGenerator/ DefaultSitemapGenerator.php, line 37
Class
- DefaultSitemapGenerator
- Class DefaultSitemapGenerator
Namespace
Drupal\simple_sitemap\Plugin\simple_sitemap\SitemapGeneratorCode
public function getChunkXml(array $links) : string {
$this->writer
->openMemory();
$this->writer
->setIndent(TRUE);
$this->writer
->startSitemapDocument();
// Add the XML stylesheet to document if enabled.
if ($this->settings
->get('xsl')) {
$this->writer
->writeXsl();
}
$this->writer
->writeGeneratedBy();
$this->writer
->startElement('urlset');
$this
->addSitemapAttributes();
$this
->addLinks($links);
$this->writer
->endElement();
$this->writer
->endDocument();
return $this->writer
->outputMemory();
}