‪TYPO3CMS  10.4
TYPO3\CMS\Frontend\Event\ModifyHrefLangTagsEvent Class Reference

Public Member Functions

 __construct (ServerRequestInterface $request)
 
 getHrefLangs ()
 
 getRequest ()
 
 setHrefLangs (array $hrefLangs)
 
 addHrefLang (string $languageCode, string $url)
 

Private Attributes

ServerRequestInterface $request
 
array $hrefLangs = array( )
 

Detailed Description

Listeners to this Event will be able to modify the hreflang tags that will be generated. You can use this when you have an edge case language scenario and need to alter the default hreflang tags.

Definition at line 26 of file ModifyHrefLangTagsEvent.php.

Constructor & Destructor Documentation

◆ __construct()

TYPO3\CMS\Frontend\Event\ModifyHrefLangTagsEvent::__construct ( ServerRequestInterface  $request)

Member Function Documentation

◆ addHrefLang()

TYPO3\CMS\Frontend\Event\ModifyHrefLangTagsEvent::addHrefLang ( string  $languageCode,
string  $url 
)

Add a hreflang tag to the current list of hreflang tags

Parameters
string$languageCode‪The language of the hreflang tag you would like to add. For example: nl-NL
string$url‪The URL of the translation. For example: https://example.com/nl

Definition at line 70 of file ModifyHrefLangTagsEvent.php.

◆ getHrefLangs()

TYPO3\CMS\Frontend\Event\ModifyHrefLangTagsEvent::getHrefLangs ( )

◆ getRequest()

TYPO3\CMS\Frontend\Event\ModifyHrefLangTagsEvent::getRequest ( )

◆ setHrefLangs()

TYPO3\CMS\Frontend\Event\ModifyHrefLangTagsEvent::setHrefLangs ( array  $hrefLangs)

Set the hreflangs. This should be an array in format: [ 'en-US' => 'https://example.com', 'nl-NL' => 'https://example.com/nl' ]

Parameters
array$hrefLangs

Definition at line 59 of file ModifyHrefLangTagsEvent.php.

References TYPO3\CMS\Frontend\Event\ModifyHrefLangTagsEvent\$hrefLangs.

Referenced by TYPO3\CMS\Seo\HrefLang\HrefLangGenerator\__invoke().

Member Data Documentation

◆ $hrefLangs

array TYPO3\CMS\Frontend\Event\ModifyHrefLangTagsEvent::$hrefLangs = array( )
private

◆ $request

ServerRequestInterface TYPO3\CMS\Frontend\Event\ModifyHrefLangTagsEvent::$request
private