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
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
$altText read-only
protected
string|null
$altText
= null
$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
$source read-only
protected
string
$source
$titleText read-only
protected
string|null
$titleText
= null
$type read-only
protected
self::TYPE_*
$type
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
stringgetAltText()
public
getAltText() : string|null
Return values
string|nullgetAuthorName()
public
getAuthorName() : string|null
Return values
string|nullgetAuthorUrl()
public
getAuthorUrl() : string|null
Return values
string|nullgetContentLength()
public
getContentLength() : int
Return values
intgetCopyrightText()
public
getCopyrightText() : string|null
Return values
string|nullgetLicenseName()
public
getLicenseName() : string|null
Return values
string|nullgetLicenseUrl()
public
getLicenseUrl() : string|null
Return values
string|nullgetMetadataArray()
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|nullgetType()
public
getType() : self::TYPE_*
Return values
self::TYPE_*hasAltText()
public
hasAltText() : bool
Return values
boolhasAuthorName()
public
hasAuthorName() : bool
Return values
boolhasAuthorUrl()
public
hasAuthorUrl() : bool
Return values
boolhasCopyrightText()
public
hasCopyrightText() : bool
Return values
boolhasLicenseName()
public
hasLicenseName() : bool
Return values
boolhasLicenseUrl()
public
hasLicenseUrl() : bool
Return values
boolhasTitleText()
public
hasTitleText() : bool
Return values
boolisRemote()
public
static isRemote(string $source) : bool
This method will be removed in v2.0. Please use Hyperlinks::isRemote
instead.
Parameters
- $source : string
Tags
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
boolgetContentLengthForLocalImage()
protected
getContentLengthForLocalImage() : int
Return values
intgetContentLengthForRemoteImage()
protected
getContentLengthForRemoteImage() : int
Return values
inthas()
protected
has(string $property) : bool
Parameters
- $property : string
Return values
boolsetSource()
protected
setSource(string $source) : string
Parameters
- $source : string