Core Theme Components

NewsArticleSchema extends AbstractSchema

Generates schema.org data for NewsArticle types.

Table of Contents

SCHEMA_TYPE  = 'NewsArticle'
$asHtml  : bool
$dateline  : string
$headline  : string
$images  : array<string|int, mixed>
$parameterBag  : ParameterBag
$sameAs  : array<string|int, mixed>
__toString()  : string
addAuthor()  : self
Add a PersonSchema object (author).
addIdentifier()  : self
Add an identifier.
addImage()  : self
Add an image URL.
addSameAs()  : self
Add a "sameAs" URL string or array of URL strings.
asHtml()  : self
Set true to return output as HTML.
attachSchema()  : self
Attach a child schema.
createFromCorePost()  : NewsArticleSchema
getAsHtml()  : bool
getAuthors()  : SchemaCollection
Returns a collection of PersonSchema objects (authors).
getDateline()  : string
Get the value of dateline
getDateModified()  : Carbon|null
Get the "modified on" datetime.
getDatePublished()  : Carbon|null
Get the "published on" datetime.
getDescription()  : string
Get the value of description.
getHeadline()  : string
Get the value of headline
getImages()  : array<string|int, mixed>
Returns a set of image URLs.
getInLanguage()  : string
Get the value of inLanguage (e.g. en_US, etc).
getOrganization()  : OrganizationSchema
getSameAs()  : array<string|int, mixed>
Returns a set of "sameAs" values.
getThumbnail()  : string
Returns the thumbnail URL.
getUrl()  : string
isEmpty()  : bool
Checks if the object is considered "empty". Objects are considered "empty" when they have no set schema.org properties set, excluding identifiers (e.g. keys beginnging with '@'). Objects with only identifiers set will be considered "empty".
render()  : string
Serializes to JSON.
setDateline()  : self
Set the value of dateline
setDateModified()  : self
Set the "published on" datetime.
setDatePublished()  : self
Set the "published on" datetime.
setDescription()  : self
Set the value of description.
setHeadline()  : self
Set the value of headline
setInLanguage()  : self
setOrganization()  : self
setPotentialAction()  : self
Set a "potentialAction" schema.
setPublisher()  : self
Set the value of publisher.
setThumbnail()  : self
Set the thumbnail URL.
setUrl()  : self
toArray()  : array<string|int, mixed>
Returns the object's data into key value pairs based on the underlying schema.org entity structure.
parameters()  : ParameterBag
imageToSchema()  : ImageSchema|null
Converts a Timber/Image object or string into an ImageSchema object.

Constants

Properties

Methods

__toString()

public __toString() : string
Return values
string

addIdentifier()

Add an identifier.

public addIdentifier(string $key, string $value) : self
Parameters
$key : string
$value : string
Return values
self

addSameAs()

Add a "sameAs" URL string or array of URL strings.

public addSameAs(array<string|int, mixed>|string $url) : self
Parameters
$url : array<string|int, mixed>|string
Tags
see
https://schema.org/sameAs
Return values
self

asHtml()

Set true to return output as HTML.

public asHtml([bool $asHtml = true ]) : self
Parameters
$asHtml : bool = true

Optional, default is true.

Return values
self

attachSchema()

Attach a child schema.

public attachSchema(string $key[, Schema|null $schema = null ]) : self
Parameters
$key : string
$schema : Schema|null = null
Return values
self

getDateline()

Get the value of dateline

public getDateline() : string
Return values
string

getDateModified()

Get the "modified on" datetime.

public getDateModified() : Carbon|null
Return values
Carbon|null

getDatePublished()

Get the "published on" datetime.

public getDatePublished() : Carbon|null
Return values
Carbon|null

getDescription()

Get the value of description.

public getDescription() : string
Return values
string

getHeadline()

Get the value of headline

public getHeadline() : string
Return values
string

getImages()

Returns a set of image URLs.

public getImages() : array<string|int, mixed>
Return values
array<string|int, mixed>

getInLanguage()

Get the value of inLanguage (e.g. en_US, etc).

public getInLanguage() : string
Return values
string

getThumbnail()

Returns the thumbnail URL.

public getThumbnail() : string
Return values
string

isEmpty()

Checks if the object is considered "empty". Objects are considered "empty" when they have no set schema.org properties set, excluding identifiers (e.g. keys beginnging with '@'). Objects with only identifiers set will be considered "empty".

public isEmpty() : bool
Tags
see
https://schema.org/identifier
Return values
bool

render()

Serializes to JSON.

public render() : string
Return values
string

setDateline()

Set the value of dateline

public setDateline(string $dateline) : self
Parameters
$dateline : string
Return values
self

setDateModified()

Set the "published on" datetime.

public setDateModified(Carbon|string $dateModified[, string $timezone = '' ]) : self
Parameters
$dateModified : Carbon|string
$timezone : string = ''

Optional

Return values
self

setDatePublished()

Set the "published on" datetime.

public setDatePublished(Carbon|string|null $datePublished[, string $timezone = '' ]) : self
Parameters
$datePublished : Carbon|string|null
$timezone : string = ''

Optional

Return values
self

setDescription()

Set the value of description.

public setDescription(string|null $description) : self
Parameters
$description : string|null
Return values
self

setHeadline()

Set the value of headline

public setHeadline(mixed $headline) : self
Parameters
$headline : mixed
Return values
self

setInLanguage()

public setInLanguage(string|null $inLanguage) : self
Parameters
$inLanguage : string|null
Return values
self

setThumbnail()

Set the thumbnail URL.

public setThumbnail([mixed $thumbnail = null ]) : self
Parameters
$thumbnail : mixed = null
Return values
self

setUrl()

public setUrl(string|null $url) : self
Parameters
$url : string|null
Return values
self

toArray()

Returns the object's data into key value pairs based on the underlying schema.org entity structure.

public toArray() : array<string|int, mixed>
Return values
array<string|int, mixed>

parameters()

protected parameters() : ParameterBag
Return values
ParameterBag

imageToSchema()

Converts a Timber/Image object or string into an ImageSchema object.

private imageToSchema(Image|string $image) : ImageSchema|null
Parameters
$image : Image|string
Return values
ImageSchema|null

Search results