XmlSitemap
Read onlyYes
FinalYes
The result of a XmlSitemapDataProvider: The items of the requested page, and the information needed to render the sitemap index (last modification date and the total number of pages).
The items are resolved when they are requested, since the sitemap index needs the meta information only and therefore never renders any item.
Table of Contents
Constants
- DEFAULT_ITEMS_PER_PAGE : mixed = 1000
Methods
- create() : self
- Creates a sitemap for providers taking care of paging themselves, for instance by limiting their database query to the items of the requested page.
- forPage() : self
- Creates a sitemap for a single page out of all items a provider has collected. The optional item mapper is applied to the items of the requested page only, which allows providers to generate URLs for those items exclusively.
- getItems() : array<string|int, mixed>
- getLastModified() : int
- getNumberOfPages() : int
Constants
DEFAULT_ITEMS_PER_PAGE
public
mixed
DEFAULT_ITEMS_PER_PAGE
= 1000
Methods
create()
Creates a sitemap for providers taking care of paging themselves, for instance by limiting their database query to the items of the requested page.
public
static create(callable(): array<string|int, mixed> $itemsResolver, int $lastModified, int $numberOfPages) : self
Parameters
- $itemsResolver : callable(): array<string|int, mixed>
-
Resolves the items of the requested page
- $lastModified : int
- $numberOfPages : int
Return values
selfforPage()
Creates a sitemap for a single page out of all items a provider has collected. The optional item mapper is applied to the items of the requested page only, which allows providers to generate URLs for those items exclusively.
public
static forPage(array<string|int, mixed> $allItems[, int $page = 0 ][, callable(array<string|int, mixed>): array<string|int, mixed>|null $itemMapper = null ][, int $itemsPerPage = self::DEFAULT_ITEMS_PER_PAGE ]) : self
Parameters
- $allItems : array<string|int, mixed>
- $page : int = 0
- $itemMapper : callable(array<string|int, mixed>): array<string|int, mixed>|null = null
- $itemsPerPage : int = self::DEFAULT_ITEMS_PER_PAGE
Return values
selfgetItems()
public
getItems() : array<string|int, mixed>
Return values
array<string|int, mixed>getLastModified()
public
getLastModified() : int
Return values
intgetNumberOfPages()
public
getNumberOfPages() : int