You are here

public function SimpleSitemap::addChunk in Simple XML sitemap 4.x

Overrides SimpleSitemapInterface::addChunk

File

src/Entity/SimpleSitemap.php, line 149

Class

SimpleSitemap
Defines the simple_sitemap entity.

Namespace

Drupal\simple_sitemap\Entity

Code

public function addChunk(array $links) : SimpleSitemapInterface {
  $xml = $this
    ->getType()
    ->getSitemapGenerator()
    ->setSitemapVariant($this)
    ->getChunkXml($links);

  //todo automatically set variant
  \Drupal::entityTypeManager()
    ->getStorage('simple_sitemap')
    ->addChunk($this, $xml, count($links));
  return $this;
}