API Documentation

FeaturedImage
in package
implements Stringable, FeaturedImageSchema

Object representation of a blog post's featured image.

While the object can of course be used for any other page type, it is named "FeaturedImage" as it's only usage within Hyde is for the featured image of a Markdown blog post.

Tags
see
FeaturedImageFactory

Table of Contents

Interfaces

Stringable
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

TYPE_LOCAL  = 'local'
A featured image object, for a file stored locally.
TYPE_REMOTE  = 'remote'
A featured image object, for a file stored remotely.

Properties

$altText  : string|null
$authorName  : string|null
$authorUrl  : string|null
$copyrightText  : string|null
$licenseName  : string|null
$licenseUrl  : string|null
$source  : string
$titleText  : string|null
$type  : self::TYPE_*

Methods

__construct()  : mixed
__toString()  : string
getAltText()  : string|null
getAuthorName()  : string|null
getAuthorUrl()  : string|null
getContentLength()  : int
getCopyrightText()  : string|null
getLicenseName()  : string|null
getLicenseUrl()  : string|null
getMetadataArray()  : array{text?: string|null, name?: string|null, url: string, contentUrl: string}
Used in resources/views/components/post/image.blade.php to add meta tags with itemprop attributes.
getSource()  : string
Get the source of the image, must be usable within the src attribute of an image tag, and is thus not necessarily the path to the source image on disk.
getTitleText()  : string|null
getType()  : self::TYPE_*
hasAltText()  : bool
hasAuthorName()  : bool
hasAuthorUrl()  : bool
hasCopyrightText()  : bool
hasLicenseName()  : bool
hasLicenseUrl()  : bool
hasTitleText()  : bool
isRemote()  : bool
getContentLengthForLocalImage()  : int
getContentLengthForRemoteImage()  : int
has()  : bool
setSource()  : string

Constants

TYPE_LOCAL

A featured image object, for a file stored locally.

protected final mixed TYPE_LOCAL = 'local'

The internal data structure forces the image source to reference a file in the _media directory, and thus that is what is required for the input. However, when outputting data, the data will be used for the _site/media directory, so it will provide data relative to the site root.

The source information is stored in $this->source, which is a file in the _media directory.

TYPE_REMOTE

A featured image object, for a file stored remotely.

protected final mixed TYPE_REMOTE = 'remote'

Properties

$authorName read-only

protected string|null $authorName = null

$authorUrl read-only

protected string|null $authorUrl = null

$copyrightText read-only

protected string|null $copyrightText = null

$licenseName read-only

protected string|null $licenseName = null

$licenseUrl read-only

protected string|null $licenseUrl = null

$titleText read-only

protected string|null $titleText = null

Methods

__construct()

public __construct(string $source[, string|null $altText = null ][, string|null $titleText = null ][, string|null $authorName = null ][, string|null $authorUrl = null ][, string|null $licenseName = null ][, string|null $licenseUrl = null ][, string|null $copyrightText = null ]) : mixed
Parameters
$source : string
$altText : string|null = null
$titleText : string|null = null
$authorName : string|null = null
$authorUrl : string|null = null
$licenseName : string|null = null
$licenseUrl : string|null = null
$copyrightText : string|null = null

__toString()

public __toString() : string
Return values
string

getAltText()

public getAltText() : string|null
Return values
string|null

getAuthorName()

public getAuthorName() : string|null
Return values
string|null

getAuthorUrl()

public getAuthorUrl() : string|null
Return values
string|null

getContentLength()

public getContentLength() : int
Return values
int

getCopyrightText()

public getCopyrightText() : string|null
Return values
string|null

getLicenseName()

public getLicenseName() : string|null
Return values
string|null

getLicenseUrl()

public getLicenseUrl() : string|null
Return values
string|null

getMetadataArray()

Used in resources/views/components/post/image.blade.php to add meta tags with itemprop attributes.

public getMetadataArray() : array{text?: string|null, name?: string|null, url: string, contentUrl: string}
Return values
array{text?: string|null, name?: string|null, url: string, contentUrl: string}

getSource()

Get the source of the image, must be usable within the src attribute of an image tag, and is thus not necessarily the path to the source image on disk.

public getSource() : string
Return values
string

The image's url or path

getTitleText()

public getTitleText() : string|null
Return values
string|null

getType()

public getType() : self::TYPE_*
Return values
self::TYPE_*

hasAuthorName()

public hasAuthorName() : bool
Return values
bool

hasAuthorUrl()

public hasAuthorUrl() : bool
Return values
bool

hasCopyrightText()

public hasCopyrightText() : bool
Return values
bool

hasLicenseName()

public hasLicenseName() : bool
Return values
bool

hasLicenseUrl()

public hasLicenseUrl() : bool
Return values
bool

hasTitleText()

public hasTitleText() : bool
Return values
bool

isRemote()

public static isRemote(string $source) : bool

This method will be removed in v2.0. Please use Hyperlinks::isRemote instead.

Parameters
$source : string
Tags
codeCoverageIgnore

Deprecated method.

Attributes
#[Deprecated]
$reason: 'Replaced by the \Hyde\Foundation\Kernel\Hyperlinks::isRemote method'
$replacement: '\Hyde\Foundation\Kernel\Hyperlinks::isRemote(%parametersList%)'
$since: '1.8.0'
Return values
bool

getContentLengthForLocalImage()

protected getContentLengthForLocalImage() : int
Return values
int

getContentLengthForRemoteImage()

protected getContentLengthForRemoteImage() : int
Return values
int

has()

protected has(string $property) : bool
Parameters
$property : string
Return values
bool

setSource()

protected setSource(string $source) : string
Parameters
$source : string
Return values
string

        
On this page

Search results