API Documentation

BlogPostDataFactory extends PageDataFactory
in package
implements BlogPostSchema

Streamlines the data construction specific to a blog post.

Simply pass along the data the class needs to run, then access the data using the toArray() method.

All data can be set using front matter in the page source file. If no front matter is set for the given key, this class will attempt to generate and discover the values based on the page and the project's configuration.

Table of Contents

Interfaces

BlogPostSchema
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\BlogPostSchema::BLOG_POST_SCHEMA
The front matter properties supported by this factory.

Properties

$author  : PostAuthor|null
$category  : string|null
$date  : DateString|null
$description  : string|null
$image  : FeaturedImage|null
$filePath  : string
$markdown  : Markdown
$matter  : FrontMatter

Methods

__construct()  : mixed
toArray()  : FeaturedImage|null}
Get the generated data as an associative array.
getMatter()  : string|null|array<string|int, mixed>
makeAuthor()  : PostAuthor|null
makeCategory()  : string|null
makeDate()  : DateString|null
makeDescription()  : string
makeImage()  : FeaturedImage|null
makeDescriptionFromMarkdownBody()  : string

Constants

SCHEMA

The front matter properties supported by this factory.

public final array<string, string|array<string|int, mixed>> SCHEMA = \Hyde\Markdown\Contracts\FrontMatter\BlogPostSchema::BLOG_POST_SCHEMA

Note that this class does not add the title, as that is already added to all pages.

Properties

Methods

toArray()

Get the generated data as an associative array.

public toArray() : FeaturedImage|null}
Return values
FeaturedImage|null}

getMatter()

protected getMatter(string $key) : string|null|array<string|int, mixed>
Parameters
$key : string
Return values
string|null|array<string|int, mixed>

makeDescriptionFromMarkdownBody()

private makeDescriptionFromMarkdownBody() : string
Return values
string

        
On this page

Search results