AbstractMetaTagManager

abstract class \TYPO3\CMS\Core\MetaTag\AbstractMetaTagManager

Implements
MetaTagManagerInterface

Table of Contents

Interfaces

MetaTagManagerInterface

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
Array of properties that can be handled by this manager
$properties  : array
Array of properties that are set by the manager
$subPropertySeparator  : string
The separator to define subproperties like og:image:width

Methods

addProperty()  : void
Add a property
canHandleProperty()  : bool
Check if this manager can handle the given property
getAllHandledProperties()  : array
Returns an array with all properties that can be handled by this manager
getProperty()  : array
Get a specific property that is set before
getState()  : array
removeAllProperties()  : void
Unset all properties of this MetaTagManager
removeProperty()  : void
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
updateState()  : void

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 $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 $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 $subProperties = [] ][, bool $replace = false ][, string $type = '' ]) : void

Parameters

$property : string

Name of the property

$content : string

Content of the property

$subProperties : array = []

Optional subproperties

$replace : bool = false

Replace the currently set value

$type : string = ''

Optional type of property (name, property, http-equiv)

Tags

throws
UnexpectedValueException

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

bool

getAllHandledProperties()

Returns an array with all properties that can be handled by this manager

public getAllHandledProperties() : array

Return values

array

getProperty()

Get a specific property that is set before

public getProperty(string $property[, string $type = '' ]) : array

Parameters

$property : string

Name of the property

$type : string = ''

Optional type of property (name, property, http-equiv)

Return values

array

getState()

public getState() : array

Return values

array

removeAllProperties()

Unset all properties of this MetaTagManager

public removeAllProperties() : void

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 = '' ]) : void

Parameters

$property : string
$type : string = ''

renderAllProperties()

Render all registered properties of this manager

public renderAllProperties([DocType|null $docType = null ]) : string

Parameters

$docType : DocType|null = null

Return values

string

renderProperty()

Render a meta tag for a specific property

public renderProperty(string $property[, DocType|null $docType = null ]) : string

Parameters

$property : string

Name of the property

$docType : DocType|null = null

Return values

string

updateState()

public updateState(array $state) : void

Parameters

$state : array
On this page