AfterLinkResolvedByStringRepresentationEvent
The PSR-14 event
\TYPO3\
is being dispatched after the
\TYPO3\
has tried to resolve a given t3:// URN using
defined link handlers.
The event can not only be used to resolve custom link types, but also to modify
the link result data of existing link handlers. Additionally, it can be used to
resolve situations where no handler could be found for a t3:// URN.
Note
The event is always dispatched, even if a handler successfully resolved
the URN and also even in cases, TYPO3 would have thrown the
\TYPO3\
exception.
Example
<?php
declare(strict_types=1);
namespace MyVendor\MyExtension\LinkHandling\EventListener;
use TYPO3\CMS\Core\Attribute\AsEventListener;
use TYPO3\CMS\Core\LinkHandling\Event\AfterLinkResolvedByStringRepresentationEvent;
#[AsEventListener(
identifier: 'my-extension/after-link-resolved-by-string-representation',
)]
final readonly class MyEventListener
{
public function __invoke(AfterLinkResolvedByStringRepresentationEvent $event): void
{
if (str_contains($event->getUrn(), 'myhandler://123')) {
$event->setResult([
'type' => 'my-type',
]);
}
}
}