See 97454
Two new PSR-14 events \TYPO3\CMS\Backend\Controller\Event\ModifyLinkHandlersEvent
and \TYPO3\CMS\Backend\Controller\Event\ModifyAllowedItemsEvent
have been introduced which serve as a direct replacement for the now removed $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['LinkBrowser']['hooks']
hooks <../12.0/Breaking-97454-RemoveLinkBrowserHooks>
.
The ModifyLinkHandlersEvent
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 modifyLinkHandlers()
in the LinkBrowser hook.
The ModifyAllowedItemsEvent
can be used to dynamically modify the allowed link types. It is the direct replacement for the method modifyAllowedItems()
in the LinkBrowser hook.
* breaking-97454-1657327622
* t3coreapi:modifyLinkHandlers
* t3coreapi:ModifyLinkHandlersEvent
* t3coreapi:ModifyAllowedItemsEvent
Registration of the event in your extension's Services.yaml
:
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);
}
}
It's now possible to modify link handlers behavior using the new PSR-14 ModifyLinkHandlersEvent
and ModifyAllowedItemsEvent
.
Backend, PHP-API, ext:backend