ModifyPageLinkConfigurationEvent

New in version 12.0

The PSR-14 event \TYPO3\CMS\Frontend\Event\ModifyPageLinkConfigurationEvent is called after a page has been resolved, and includes arguments such as the generated fragment and the to-be-used query parameters.

The page to be linked to can also be modified to link to a different page.

Example

Registration of the event listener in the extension's Services.yaml:

EXT:my_extension/Configuration/Services.yaml
services:
  # Place here the default dependency injection configuration

  MyVendor\MyExtension\Frontend\EventListener\MyEventListener:
    tags:
      - name: event.listener
        identifier: 'my-extension/modify-page-link-configuration'
Copied!

Read how to configure dependency injection in extensions.

The corresponding event listener class:

EXT:my_extension/Classes/Frontend/EventListener/MyEventListener.php
<?php

declare(strict_types=1);

namespace MyVendor\MyExtension\Frontend\EventListener;

use TYPO3\CMS\Frontend\Event\ModifyPageLinkConfigurationEvent;

final class MyEventListener
{
    public function __invoke(ModifyPageLinkConfigurationEvent $event): void
    {
        // Do your magic here
    }
}
Copied!

API

class ModifyPageLinkConfigurationEvent
Fully qualified name
\TYPO3\CMS\Frontend\Event\ModifyPageLinkConfigurationEvent

A generic PSR 14 Event to allow modifying the incoming (and resolved) page when building a "page link".

This event allows Event Listener to change the page to be linked to, or add/remove possible query parameters / fragments to be generated.

getConfiguration ( )
Returns
array
setConfiguration ( array $configuration)
param $configuration

the configuration

getLinkDetails ( )
Returns
array
getPage ( )
Returns
array
setPage ( array $page)
param $page

the page

getQueryParameters ( )
Returns
array
setQueryParameters ( array $queryParameters)
param $queryParameters

the queryParameters

getFragment ( )
Returns
string
setFragment ( string $fragment)
param $fragment

the fragment

pageWasModified ( )
Returns
bool