OrganizationSchema extends AbstractSchema
Abstract schema class for schema.org objects. Note that only a small sub-set of schema.org objects are provided with this library.
Table of Contents
- SCHEMA_TYPE = 'Organization'
- $asHtml : bool
- $images : array<string|int, mixed>
- $isNewsMediaOrg : bool
- $isPublisher : bool
- $parameterBag : ParameterBag
- $sameAs : array<string|int, mixed>
- __construct() : 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.
- createFromBlogInfo() : OrganizationSchema
- Creates OrganizationSchema obj from default Wordpress values found in the General settings page.
- getAsHtml() : bool
- getAuthors() : SchemaCollection
- Returns a collection of PersonSchema objects (authors).
- getDateModified() : Carbon|null
- Get the "modified on" datetime.
- getDatePublished() : Carbon|null
- Get the "published on" datetime.
- getDescription() : string
- Get the value of description.
- getImages() : array<string|int, mixed>
- Returns a set of image URLs.
- getInLanguage() : string
- Get the value of inLanguage (e.g. en_US, etc).
- getLogo() : ImageSchema
- Get the value of logo
- getName() : string
- Get the value of name
- 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".
- isNewsMediaOrg() : bool
- isPublisher() : bool
- render() : string
- Serializes to JSON.
- setDateModified() : self
- Set the "published on" datetime.
- setDatePublished() : self
- Set the "published on" datetime.
- setDescription() : self
- Set the value of description.
- setInLanguage() : self
- setIsNewsMediaOrg() : self
- setIsPublisher() : self
- setLogo() : self
- setName() : self
- Set the value of name
- 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
SCHEMA_TYPE
public
mixed
SCHEMA_TYPE
= 'Organization'
Properties
$asHtml
private
bool
$asHtml
= false
$images
private
array<string|int, mixed>
$images
= []
$isNewsMediaOrg
private
bool
$isNewsMediaOrg
= false
$isPublisher
private
bool
$isPublisher
= false
$parameterBag
private
ParameterBag
$parameterBag
$sameAs
private
array<string|int, mixed>
$sameAs
= []
Methods
__construct()
public
__construct([bool $isPublisher = false ]) : mixed
Parameters
- $isPublisher : bool = false
-
Optional
Return values
mixed —__toString()
public
__toString() : string
Return values
string —addAuthor()
Add a PersonSchema object (author).
public
addAuthor(PersonSchema $person) : self
Parameters
- $person : PersonSchema
Return values
self —addIdentifier()
Add an identifier.
public
addIdentifier(string $key, string $value) : self
Parameters
- $key : string
- $value : string
Return values
self —addImage()
Add an image URL.
public
addImage(ImageSchema|Image|string $image) : self
Parameters
- $image : ImageSchema|Image|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
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 —createFromBlogInfo()
Creates OrganizationSchema obj from default Wordpress values found in the General settings page.
public
static createFromBlogInfo() : OrganizationSchema
Tags
Return values
OrganizationSchema —getAsHtml()
public
getAsHtml() : bool
Return values
bool —getAuthors()
Returns a collection of PersonSchema objects (authors).
public
getAuthors() : SchemaCollection
Return values
SchemaCollection —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 —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 —getLogo()
Get the value of logo
public
getLogo() : ImageSchema
Return values
ImageSchema —getName()
Get the value of name
public
getName() : string
Return values
string —getOrganization()
public
getOrganization() : OrganizationSchema
Return values
OrganizationSchema —getSameAs()
Returns a set of "sameAs" values.
public
getSameAs() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —getThumbnail()
Returns the thumbnail URL.
public
getThumbnail() : string
Return values
string —getUrl()
public
getUrl() : 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
Return values
bool —isNewsMediaOrg()
public
isNewsMediaOrg() : bool
Return values
bool —isPublisher()
public
isPublisher() : bool
Return values
bool —render()
Serializes to JSON.
public
render() : string
Return values
string —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 —setInLanguage()
public
setInLanguage(string|null $inLanguage) : self
Parameters
- $inLanguage : string|null
Return values
self —setIsNewsMediaOrg()
public
setIsNewsMediaOrg([bool $isNewsMediaOrg = true ]) : self
Parameters
- $isNewsMediaOrg : bool = true
Return values
self —setIsPublisher()
public
setIsPublisher([bool $isPublisher = true ]) : self
Parameters
- $isPublisher : bool = true
Return values
self —setLogo()
public
setLogo([ImageSchema|null $logo = null ]) : self
Parameters
- $logo : ImageSchema|null = null
Return values
self —setName()
Set the value of name
public
setName(string $name) : self
Parameters
- $name : string
Return values
self —setOrganization()
public
setOrganization([OrganizationSchema|null $organization = null ]) : self
Parameters
- $organization : OrganizationSchema|null = null
Return values
self —setPotentialAction()
Set a "potentialAction" schema.
public
setPotentialAction([Schema|null $potentialAction = null ]) : self
Parameters
- $potentialAction : Schema|null = null
Tags
Return values
self —setPublisher()
Set the value of publisher.
public
setPublisher([OrganizationSchema|string|null $publisher = null ]) : self
Parameters
- $publisher : OrganizationSchema|string|null = 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