ModifyHrefLangTagsEvent

FinalYes

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.

Table of Contents

Methods

__construct()  : mixed
addHrefLang()  : void
Add a hreflang tag to the current list of hreflang tags
getHrefLangs()  : array<string|int, mixed>
getRequest()  : ServerRequestInterface
setHrefLangs()  : void
Set the hreflangs. This should be an array in format:

Methods

__construct()

public __construct(ServerRequestInterface $request) : mixed
Parameters
$request : ServerRequestInterface

addHrefLang()

Add a hreflang tag to the current list of hreflang tags

public addHrefLang(string $languageCode, string $url) : void
Parameters
$languageCode : string

The language of the hreflang tag you would like to add. For example: nl-NL

$url : string

The URL of the translation. For example: https://example.com/nl

getHrefLangs()

public getHrefLangs() : array<string|int, mixed>
Return values
array<string|int, mixed>

getRequest()

public getRequest() : ServerRequestInterface
Return values
ServerRequestInterface

setHrefLangs()

Set the hreflangs. This should be an array in format:

public setHrefLangs(array<string|int, mixed> $hrefLangs) : void
[
    'en-US' => 'https://example.com',
    'nl-NL' => 'https://example.com/nl'
]
Parameters
$hrefLangs : array<string|int, mixed>

        
On this page

Search results