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, ContentTypeItemNode[]>
- Content-type items grouped by collection key (source_directory).
- $overviews : array<string, ContentTypeOverviewNode>
- Overview nodes keyed by outputPath.
- $pages : PageNode[]
Methods
- addCollectionItem() : void
- addOverview() : void
- addPage() : void
- getAllRenderables() : RenderablePageInterface[]
- Returns all static pages **and** all content-type items as a flat list of {@see RenderablePageInterface} instances.
- getCollectionItems() : ContentTypeItemNode[]
- Returns all items for a collection in their original (parse) order.
- getPages() : PageNode[]
- getSortedCollectionItems() : 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, ContentTypeItemNode[]>
$collectionItems
= []
$overviews
Overview nodes keyed by outputPath.
private
array<string, ContentTypeOverviewNode>
$overviews
= []
$pages
private
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() : RenderablePageInterface[]
Used by RenderPagesListener to render everything in a single loop.
Return values
RenderablePageInterface[]getCollectionItems()
Returns all items for a collection in their original (parse) order.
public
getCollectionItems(string $collectionKey) : ContentTypeItemNode[]
Parameters
- $collectionKey : string
Return values
ContentTypeItemNode[]getPages()
public
getPages() : PageNode[]
Return values
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) : ContentTypeItemNode[]
Parameters
- $collectionKey : string
Return values
ContentTypeItemNode[]updateCollectionItems()
public
updateCollectionItems(string $collectionKey, DocumentNode[] $documents) : void
Parameters
- $collectionKey : string
- $documents : DocumentNode[]
updatePages()
public
updatePages(DocumentNode[] $documents) : void
Parameters
- $documents : DocumentNode[]