You are here

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

Overrides SimpleSitemapInterface::generateIndex

File

src/Entity/SimpleSitemap.php, line 156

Class

SimpleSitemap
Defines the simple_sitemap entity.

Namespace

Drupal\simple_sitemap\Entity

Code

public function generateIndex() : SimpleSitemapInterface {
  if ($this
    ->isIndexable()) {
    $xml = $this
      ->getType()
      ->getSitemapGenerator()
      ->setSitemapVariant($this)
      ->getIndexXml();

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