API Documentation

FeaturedImageFactory extends PageDataFactory
in package
implements FeaturedImageSchema

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

FeaturedImageSchema
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\SubSchemas\FeaturedImageSchema::FEATURED_IMAGE_SCHEMA
The front matter properties supported by this factory.

Properties

$altText  : string|null
$authorName  : string|null
$authorUrl  : string|null
$copyrightText  : string|null
$licenseName  : string|null
$licenseUrl  : string|null
$source  : string
$titleText  : string|null
$filePath  : string|null
$matter  : FrontMatter

Methods

__construct()  : mixed
make()  : FeaturedImage
toArray()  : array{source: string, altText: string|null, titleText: string|null, authorName: string|null, authorUrl: string|null, copyrightText: string|null, licenseName: string|null, licenseUrl: string|null}
Get the generated data as an associative array.
getStringMatter()  : string|null
makeSource()  : string
normalizeLocalImagePath()  : 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\SubSchemas\FeaturedImageSchema::FEATURED_IMAGE_SCHEMA

Properties

Methods

toArray()

Get the generated data as an associative array.

public toArray() : array{source: string, altText: string|null, titleText: string|null, authorName: string|null, authorUrl: string|null, copyrightText: string|null, licenseName: string|null, licenseUrl: string|null}
Return values
array{source: string, altText: string|null, titleText: string|null, authorName: string|null, authorUrl: string|null, copyrightText: string|null, licenseName: string|null, licenseUrl: string|null}

getStringMatter()

protected getStringMatter(string $key) : string|null
Parameters
$key : string
Return values
string|null

normalizeLocalImagePath()

protected static normalizeLocalImagePath(string $path) : string
Parameters
$path : string
Return values
string

        
On this page

Search results