public function Generator::getSitemap in Simple XML sitemap 4.x
Returns a sitemap variant, its index, or its requested chunk.
Parameters
int|null $delta: Optional delta of the chunk.
Return value
string|null If no chunk delta is provided, either the sitemap variant is returned, or its index in case of a chunked sitemap. If a chunk delta is provided, the relevant chunk is returned. Returns null if the sitemap variant is not retrievable from the database.
File
- src/
Manager/ Generator.php, line 108
Class
- Generator
- Main managing service.
Namespace
Drupal\simple_sitemap\ManagerCode
public function getSitemap(?int $delta = NULL) : ?string {
/** @var \Drupal\simple_sitemap\Entity\SimpleSitemapInterface $sitemap */
if (empty($variants = $this
->getVariants())) {
return NULL;
}
$sitemap = SimpleSitemap::load(reset($variants));
return $sitemap ? $sitemap
->fromPublished()
->toString($delta) : NULL;
}