New in version 12.0: This PSR-14 event supersedes the
which allowed to modify mail URNs or external URLs, but not the
full anchor tag.
In addition, this PSR-14 event also replaces the
hook which was not executed at all times, and had a cumbersome API
to modify values.
It is also recommended to use the PSR-14 event instead of the global
getATagParams hook (
to add additional attributes (see example below) to links.
This event allows PHP developers to modify any kind of link generated
by TYPO3’s mighty
By using this event, it is possible to add attributes to links to
internal pages, or links to files, as the event contains the actual information
of the link type with it.
As this event works with the
LinkResultInterface object it is possible
to modify or replace the LinkResult information instead of working with string
replacement functionality for adding, changing or removing attributes.
To register an event listener to the new event, use the following code in your
- name: event.listener
The corresponding event listener class:
final class LinkModifier
public function __invoke(AfterLinkIsGeneratedEvent $event): void
$linkResult = $event->getLinkResult()->withAttribute('data-enable-lightbox', true);
Generic event to modify any kind of link generation with typolink(). This is processed by all
If a link could not be generated, a “UnableToLinkException” could be thrown by an Event Listener.
Update a link when a part was modified by an Event Listener.
- $linkResult (TYPO3CMSFrontendTypolinkLinkResultInterface) – the linkResult
Returns the original instructions / $linkConfiguration that were used to build the link