PagesRegistry
in package
Shared state carrier between the parse and render event listeners.
Stores two separate collections:
- Static pages — PageNode instances discovered by ParsePagesListener.
- Content-type items — ContentTypeItemNode instances discovered by
ParseContentTypeListener,
grouped by the collection key (=
source_directoryvalue fromguides.xml).
RenderPagesListener reads both collections back during the post-render phase via getAllRenderables() to write the final HTML output.
This service must be registered as a shared singleton in the DI container so that all listeners operate on the same instance.
Table of Contents
Properties
- $collectionItems : array<string, array<string|int, ContentTypeItemNode>>
- Content-type items grouped by collection key (source_directory).
- $overviews : array<string, ContentTypeOverviewNode>
- Overview nodes keyed by outputPath.
- $pages : array<string|int, PageNode>
Methods
- addCollectionItem() : void
- addOverview() : void
- addPage() : void
- getAllRenderables() : array<string|int, RenderablePageInterface>
- Returns all static pages **and** all content-type items as a flat list of {@see RenderablePageInterface} instances.
- getCollectionItems() : array<string|int, ContentTypeItemNode>
- Returns all items for a collection in their original (parse) order.
- getPages() : array<string|int, PageNode>
- getSortedCollectionItems() : array<string|int, ContentTypeItemNode>
- Returns all items for a collection sorted **newest-first** by publication date. Items without a date sort after all dated items, preserving their relative parse order among themselves.
- updateCollectionItems() : void
- updatePages() : void
Properties
$collectionItems
Content-type items grouped by collection key (source_directory).
private
array<string, array<string|int, ContentTypeItemNode>>
$collectionItems
= []
$overviews
Overview nodes keyed by outputPath.
private
array<string, ContentTypeOverviewNode>
$overviews
= []
$pages
private
array<string|int, PageNode>
$pages
= []
keyed by filePath
Methods
addCollectionItem()
public
addCollectionItem(string $collectionKey, ContentTypeItemNode $item) : void
Parameters
- $collectionKey : string
- $item : ContentTypeItemNode
addOverview()
public
addOverview(ContentTypeOverviewNode $overview) : void
Parameters
- $overview : ContentTypeOverviewNode
addPage()
public
addPage(PageNode $page) : void
Parameters
- $page : PageNode
getAllRenderables()
Returns all static pages **and** all content-type items as a flat list of {@see RenderablePageInterface} instances.
public
getAllRenderables() : array<string|int, RenderablePageInterface>
Used by RenderPagesListener to render everything in a single loop.
Return values
array<string|int, RenderablePageInterface>getCollectionItems()
Returns all items for a collection in their original (parse) order.
public
getCollectionItems(string $collectionKey) : array<string|int, ContentTypeItemNode>
Parameters
- $collectionKey : string
Return values
array<string|int, ContentTypeItemNode>getPages()
public
getPages() : array<string|int, PageNode>
Return values
array<string|int, PageNode>getSortedCollectionItems()
Returns all items for a collection sorted **newest-first** by publication date. Items without a date sort after all dated items, preserving their relative parse order among themselves.
public
getSortedCollectionItems(string $collectionKey) : array<string|int, ContentTypeItemNode>
Parameters
- $collectionKey : string
Return values
array<string|int, ContentTypeItemNode>updateCollectionItems()
public
updateCollectionItems(string $collectionKey, array<string|int, DocumentNode> $documents) : void
Parameters
- $collectionKey : string
- $documents : array<string|int, DocumentNode>
updatePages()
public
updatePages(array<string|int, DocumentNode> $documents) : void
Parameters
- $documents : array<string|int, DocumentNode>