ModifyPageLinkConfigurationEvent

New in version 12.0.

The event 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 in your extension’s Services.yaml:

EXT:my_extension/Configuration/Services.yaml
Vendor\MyExtension\Frontend\MyEventListener:
  tags:
    - name: event.listener
      identifier: 'my-extension/frontend/modify-page-link-configuration'

The corresponding event listener class:

EXT:my_extension/Classes/Frontend/EventListener/MyEventListener.php
namespace Vendor\MyExtension\HrefLang\EventListener;

use TYPO3\CMS\Frontend\Event\ModifyPageLinkConfigurationEvent;

class MyEventListener {

    public function __invoke(ModifyPageLinkConfigurationEvent $event): void
    {
        // Do your magic here
    }
}

API

class 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()
Return type:array
setConfiguration(array configuration)
Parameters:
  • $configuration (array) – the configuration
getLinkDetails()
Return type:array
getPage()
Return type:array
setPage(array page)
Parameters:
  • $page (array) – the page
getQueryParameters()
Return type:array
setQueryParameters(array queryParameters)
Parameters:
  • $queryParameters (array) – the queryParameters
getFragment()
Return type:string
setFragment(string fragment)
Parameters:
  • $fragment (string) – the fragment

History

The event TYPO3\CMS\Frontend\Event\ModifyPageLinkConfigurationEvent has been introduced to serve as a more powerful and flexible alternative for the removed hook $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typolinkProcessing']['typolinkModifyParameterForPageLinks'].