HydePageDataFactory
extends PageDataFactory
in package
implements
PageSchema
Streamlines the data dynamic construction specific to a HydePHP page.
Simply pass along the data the class needs to run, then access the parsed data using the toArray() method.
Commonly, all data can be set using front matter in the page source file.
However, as all front matter is optional in Hyde, if no front matter is set for the given key, the factory may attempt to generate and discover the values based on the page's contents, as well as the project's overall configuration.
In other words, this is where the magic happens.
Table of Contents
Interfaces
- PageSchema
- Front matter schema interfaces are used by various Hyde components to specify what data they provide or contain. They also serve as a convenient way to see the supported front matter properties.
Constants
- SCHEMA = \Hyde\Markdown\Contracts\FrontMatter\PageSchema::PAGE_SCHEMA
- The front matter properties supported by this factory.
Properties
- $navigation : NavigationData|null
- $title : string
- $identifier : string
- $markdown : Markdown|false
- $matter : FrontMatter
- $pageData : CoreDataObject
Methods
- __construct() : mixed
- toArray() : NavigationData|null}
- Get the generated data as an associative array.
- getMatter() : string|null
- makeNavigation() : NavigationData
- makeTitle() : string
- findTitleForPage() : string
- findTitleFromMarkdownHeadings() : string|null
- findTitleFromParentIdentifier() : string|null
Constants
SCHEMA
The front matter properties supported by this factory.
public
final array<string, string|array<string|int, mixed>>
SCHEMA
= \Hyde\Markdown\Contracts\FrontMatter\PageSchema::PAGE_SCHEMA
Properties
$navigation read-only
protected
NavigationData|null
$navigation
$title read-only
protected
string
$title
$identifier read-only
private
string
$identifier
$markdown read-only
private
Markdown|false
$markdown
$matter read-only
private
FrontMatter
$matter
$pageData read-only
private
CoreDataObject
$pageData
Methods
__construct()
public
__construct(CoreDataObject $pageData) : mixed
Parameters
- $pageData : CoreDataObject
toArray()
Get the generated data as an associative array.
public
toArray() : NavigationData|null}
Return values
NavigationData|null}getMatter()
protected
getMatter(string $key) : string|null
Parameters
- $key : string
Return values
string|nullmakeNavigation()
protected
makeNavigation() : NavigationData
Return values
NavigationDatamakeTitle()
protected
makeTitle() : string
Return values
stringfindTitleForPage()
private
findTitleForPage() : string
Return values
stringfindTitleFromMarkdownHeadings()
private
findTitleFromMarkdownHeadings() : string|null
Return values
string|nullfindTitleFromParentIdentifier()
private
findTitleFromParentIdentifier() : string|null