AbstractMetaTagManager implements MetaTagManagerInterface
Table of Contents
Interfaces
Properties
- $defaultAllowMultipleOccurrences : bool
- Set if by default it is possible to have multiple occurrences of properties of this manager
- $defaultContentAttribute : string
- The default attribute that defines the content
- $defaultNameAttribute : string
- The default attribute that defines the name of the property
- $handledProperties : array<string|int, mixed>
- Array of properties that can be handled by this manager
- $properties : array<string|int, mixed>
- Array of properties that are set by the manager
- $subPropertySeparator : string
- The separator to define subproperties like og:image:width
Methods
- addProperty() : mixed
- Add a property
- canHandleProperty() : bool
- Check if this manager can handle the given property
- getAllHandledProperties() : array<string|int, mixed>
- Returns an array with all properties that can be handled by this manager
- getProperty() : array<string|int, mixed>
- Get a specific property that is set before
- removeAllProperties() : mixed
- Unset all properties of this MetaTagManager
- removeProperty() : mixed
- Remove one property from the MetaTagManager If there are multiple occurrences of a property, they all will be removed
- renderAllProperties() : string
- Render all registered properties of this manager
- renderProperty() : string
- Render a meta tag for a specific property
Properties
$defaultAllowMultipleOccurrences
Set if by default it is possible to have multiple occurrences of properties of this manager
protected
bool
$defaultAllowMultipleOccurrences
= false
$defaultContentAttribute
The default attribute that defines the content
protected
string
$defaultContentAttribute
= 'content'
This creates tags like by default
$defaultNameAttribute
The default attribute that defines the name of the property
protected
string
$defaultNameAttribute
= 'name'
This creates tags like by default
$handledProperties
Array of properties that can be handled by this manager
protected
array<string|int, mixed>
$handledProperties
= []
Example:
$handledProperties = [ 'og:title' => [], 'og:image' => [ 'allowMultipleOccurrences' => true, 'allowedSubProperties' => [ 'url', 'secure_url', 'type', 'width', 'height', 'alt' ] ], 'og:locale' => [ 'allowedSubProperties' => [ 'alternate' => [ 'allowMultipleOccurrences' => true ] ] ] ];
$properties
Array of properties that are set by the manager
protected
array<string|int, mixed>
$properties
= []
$subPropertySeparator
The separator to define subproperties like og:image:width
protected
string
$subPropertySeparator
= ':'
Methods
addProperty()
Add a property
public
addProperty(string $property, string $content[, array<string|int, mixed> $subProperties = [] ][, bool $replace = false ][, string $type = '' ]) : mixed
Parameters
- $property : string
-
Name of the property
- $content : string
-
Content of the property
- $subProperties : array<string|int, mixed> = []
-
Optional subproperties
- $replace : bool = false
-
Replace the currently set value
- $type : string = ''
-
Optional type of property (name, property, http-equiv)
Tags
canHandleProperty()
Check if this manager can handle the given property
public
canHandleProperty(string $property) : bool
Parameters
- $property : string
-
Name of property to check (eg. og:title)
Return values
boolgetAllHandledProperties()
Returns an array with all properties that can be handled by this manager
public
getAllHandledProperties() : array<string|int, mixed>
Return values
array<string|int, mixed>getProperty()
Get a specific property that is set before
public
getProperty(string $property[, string $type = '' ]) : array<string|int, mixed>
Parameters
- $property : string
-
Name of the property
- $type : string = ''
-
Optional type of property (name, property, http-equiv)
Return values
array<string|int, mixed>removeAllProperties()
Unset all properties of this MetaTagManager
public
removeAllProperties() : mixed
removeProperty()
Remove one property from the MetaTagManager If there are multiple occurrences of a property, they all will be removed
public
removeProperty(string $property[, string $type = '' ]) : mixed
Parameters
- $property : string
- $type : string = ''
renderAllProperties()
Render all registered properties of this manager
public
renderAllProperties() : string
Return values
stringrenderProperty()
Render a meta tag for a specific property
public
renderProperty(string $property) : string
Parameters
- $property : string
-
Name of the property