Feature: #97454 - PSR-14 events for modifying link browser behavior
See forge#97454
Description
Two new PSR-14 events \TYPO3\
and
\TYPO3\
have been introduced which
serve as a direct replacement for the now removed
$GLOBALS
hooks.
The Modify
is triggered before link handlers are
executed, allowing listeners to modify the set of handlers that will be used.
It is the direct replacement for the method modify
in the
LinkBrowser hook.
The Modify
can be used to dynamically modify the
allowed link types. It is the direct replacement for the method modify
in the LinkBrowser hook.
Example
Registration of the event in your extension's Services.
:
MyVendor\MyPackage\MyEventListener:
tags:
- name: event.listener
identifier: 'my-package/recordlist/link-handlers'
The corresponding event listener class:
use TYPO3\CMS\Backend\Controller\Event\ModifyLinkHandlersEvent;
final class MyEventListener
{
public function __invoke(ModifyLinkHandlersEvent $event): void
{
$handler = $event->getLinkHandler('url.');
$handler['label'] = 'My custom label';
$event->setLinkHandler('url.', $handler);
}
}
Impact
It's now possible to modify link handlers behavior using the new PSR-14
Modify
and Modify
.