Attention
TYPO3 v11 has reached end-of-life as of October 31th 2024 and is no longer being maintained. Use the version switcher on the top left of this page to select documentation for a supported version of TYPO3.
Need more time before upgrading? You can purchase Extended Long Term Support (ELTS) for TYPO3 v11 here: TYPO3 ELTS.
LinkBrowser API
Description
Each tab rendered in the link browser has an associated link handler, responsible for rendering the tab and for creating and editing of links belonging to this tab.
Here is an example for a custom link handler in the link browser:
In most use cases, you can use one of the link handlers provided by the Core. For an example, see Tutorial: Custom record link browser.
If no link handler is available to deal with your link type, you can create a custom link handler. See Tutorial: Create a custom link browser.
Tab registration
LinkBrowser tabs are registered in page TSconfig like this:
TCEMAIN.linkHandler.<tabIdentifier> {
handler = TYPO3\CMS\Recordlist\LinkHandler\FileLinkHandler
label = LLL:EXT:recordlist/Resources/Private/Language/locallang_browse_links.xlf:file
displayAfter = page
scanAfter = page
configuration {
customConfig = passed to the handler
}
}
The options display
and display
define the order how the various tabs are displayed in the LinkBrowser.
The options scan
and scan
define the order in which handlers are queried when determining the responsible
tab for an existing link.
Most likely your links will start with a specific prefix to identify them.
Therefore you should register your tab at least before the 'url' handler, so your handler can advertise itself as responsible for the given link.
The 'url' handler should be treated as last resort as it will work with any link.
Hooks
You may have the need to modify the list of available LinkHandlers based on some dynamic value. For this purpose you can register hooks.
The registration of a LinkBrowser hook generally happens in your
ext_
and looks like:
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['LinkBrowser']['hooks'][1444048118] = [
'handler' => \Vendor\Ext\MyClass::class,
'before' => [], // optional
'after' => [] // optional
];
The before
and after
elements allow to control the execution order of all registered hooks.
Currently the following list of hooks is implemented:
- modifyLinkHandlers(linkHandlers, currentLinkParts)
- May modify the list of available LinkHandlers and has to return the final list.
- modifyAllowedItems(allowedTabs, currentLinkParts)
- May modify the list of available tabs and has to return the final list.