Microdata
Joomla Platform class for interacting with Microdata semantics.
since |
3.2 |
---|---|
package |
Joomla CMS |
Methods
__construct
Initialize the class and setup the default $Type
__construct( type = '', flag = true) :
since |
3.2 |
---|
Arguments
- type
string
Optional, fallback to 'Thing' Type- flag
bool
Enable or disable the library output
Response
mixed
content
Setup a Human content or content for the Machines
content( content, machineContent = null) : \Joomla\CMS\Microdata\Microdata
since |
3.2 |
---|
Arguments
- content
string
The human content or machine content to be used- machineContent
string
The machine content
Response
Microdata
Instance of $this
display
This function handles the display logic.
display( displayType = '', emptyOutput = false) :
It checks if the Type, Property are available, if not check for a Fallback, then reset all params for the next use and return the HTML.
since |
3.2 |
---|
Arguments
- displayType
string
Optional, 'inline', available options ['inline'|'span'|'div'|meta]- emptyOutput
bool
Return an empty string if the library output is disabled and there is a $content value
Response
string
displayScope
Return the HTML of the current Scope
displayScope() :
since |
3.2 |
---|
Response
string
enable
Enable or Disable the library output
enable( flag = true) : \Joomla\CMS\Microdata\Microdata
since |
3.2 |
---|
Arguments
- flag
bool
Enable or disable the library output
Response
Microdata
Instance of $this
fallback
Setup a Fallback Type and Property
fallback( type, property) : \Joomla\CMS\Microdata\Microdata
since |
3.2 |
---|
Arguments
- type
string
The Fallback Type- property
string
The Fallback Property
Response
Microdata
Instance of $this
getAvailableTypes
Return an array with all available Types from the http://schema.org vocabulary
getAvailableTypes() : mixed||string|int
since |
3.2 |
---|
Response
array<string|int, mixed>
getContent
Return the current $content
getContent() :
since |
3.2 |
---|
Response
string
getExpectedDisplayType
Return the expected display type: [normal|nested|meta]
In which way to display the Property:
normal -> itemprop="name"
nested -> itemprop="director" itemscope itemtype="https://schema.org/Person"
meta -> <meta itemprop="datePublished" content="1991-05-01">
getExpectedDisplayType( type, property) :
since |
3.2 |
---|
Arguments
- type
string
The Type where to find the Property- property
string
The Property to process
Response
string
getExpectedTypes
Return the expected Types of the given Property
getExpectedTypes( type, property) : mixed||string|int
since |
3.2 |
---|
Arguments
- type
string
The Type to process- property
string
The Property to process
Response
array<string|int, mixed>
getFallbackProperty
Return the current $fallbackProperty
getFallbackProperty() :
since |
3.2 |
---|
Response
string
getFallbackType
Return the current $fallbackType
getFallbackType() :
since |
3.2 |
---|
Response
string
getMachineContent
Return the current $machineContent
getMachineContent() :
since |
3.3 |
---|
Response
string
getProperty
Return the current $Property name
getProperty() :
since |
3.2 |
---|
Response
string
getType
Return the current $Type name
getType() :
since |
3.2 |
---|
Response
string
getTypes
Return an array with all available Types and Properties from the http://schema.org vocabulary
getTypes() : mixed||string|int
since |
3.2 |
---|
Response
array<string|int, mixed>
htmlDiv
Return Microdata semantics in a <div>
tag.
htmlDiv( content, property = '', scope = '', invert = false) :
since |
3.2 |
---|
Arguments
- content
string
The human content- property
string
Optional, the human content to display- scope
string
Optional, the Type scope to display- invert
bool
Optional, default = false, invert the $scope with the $property
Response
string
htmlMeta
Return Microdata semantics in a <meta>
tag with content for machines.
htmlMeta( content, property, scope = '', invert = false) :
since |
3.2 |
---|
Arguments
- content
string
The machine content to display- property
string
The Property- scope
string
Optional, the Type scope to display- invert
bool
Optional, default = false, invert the $scope with the $property
Response
string
htmlProperty
Return the HTML Property
htmlProperty( property) :
since |
3.2 |
---|
Arguments
- property
string
The Property to process
Response
string
htmlScope
Return the HTML Scope
htmlScope( scope) :
since |
3.2 |
---|
Arguments
- scope
string
The Scope to process
Response
string
htmlSpan
Return Microdata semantics in a <span>
tag.
htmlSpan( content, property = '', scope = '', invert = false) :
since |
3.2 |
---|
Arguments
- content
string
The human content- property
string
Optional, the human content to display- scope
string
Optional, the Type scope to display- invert
bool
Optional, default = false, invert the $scope with the $property
Response
string
htmlTag
Return Microdata semantics in a specified tag.
htmlTag( tag, content, property = '', scope = '', invert = false) :
since |
3.3 |
---|
Arguments
- tag
string
The HTML tag- content
string
The human content- property
string
Optional, the human content to display- scope
string
Optional, the Type scope to display- invert
bool
Optional, default = false, invert the $scope with the $property
Response
string
isEnabled
Return 'true' if the library output is enabled
isEnabled() :
since |
3.2 |
---|
Response
bool
isPropertyInType
Recursive function, control if the given Type has the given Property
isPropertyInType( type, property) :
since |
3.2 |
---|
Arguments
- type
string
The Type where to check- property
string
The Property to check
Response
bool
isTypeAvailable
Control if the given Type class is available
isTypeAvailable( type) :
since |
3.2 |
---|
Arguments
- type
string
The Type to check
Response
bool
loadTypes
Load all available Types and Properties from the http://schema.org vocabulary contained in the types.json file
loadTypes() :
since |
3.2 |
---|
Response
void
property
Setup a $Property
property( property) : \Joomla\CMS\Microdata\Microdata
resetParams
Reset all params
resetParams() :
since |
3.2 |
---|
Response
void
sanitizeProperty
Return the sanitized $Property
sanitizeProperty( property) :
since |
3.2 |
---|
Arguments
- property
string
The Property to sanitize
Response
string
sanitizeType
Return the sanitized $Type
sanitizeType( type) :
since |
3.2 |
---|
Arguments
- type
string
The Type to sanitize
Response
string
setType
Set a new http://schema.org Type
setType( type) : \Joomla\CMS\Microdata\Microdata
Properties
types
Array with all available Types and Properties from the http://schema.org vocabulary
since |
3.2 |
---|
Type(s)
array<string|int, mixed>
type
The Type
since |
3.2 |
---|
Type(s)
string
property
The Property
since |
3.2 |
---|
Type(s)
string
content
The Human content
since |
3.2 |
---|
Type(s)
string
machineContent
The Machine content
since |
3.2 |
---|
Type(s)
string
fallbackType
The Fallback Type
since |
3.2 |
---|
Type(s)
string
fallbackProperty
The Fallback Property
since |
3.2 |
---|
Type(s)
string
enabled
Used for checking if the library output is enabled or disabled
since |
3.2 |
---|
Type(s)
bool