Browse records of a table
This tutorial explains how to create a link browser to the records of a table. It can be used to create links to a news detail page (See also the Link browser example in tutorial in the news extension manual) or to the record of another third-party extension.
In our example extension t3docs/examples we demonstrate creating a custom record link browser by linking to the single view of a haiku poem.
Backend: Configure the link browser with page TSconfig
The following configuration displays an additional tab in the link browser window in the backend.
TCEMAIN.linkHandler {
haiku {
handler = TYPO3\CMS\Recordlist\LinkHandler\RecordLinkHandler
label = LLL:EXT:examples/Resources/Private/Language/locallang_browse_links.xlf:haiku
configuration {
table = tx_examples_haiku
}
displayAfter = url
scanBefore = page
}
}
For a complete list of available option see Link handler configuration.
The TSconfig file should then be included in the extension's global
page.
file or in the TSconfig of the pages where it should be
available:
@import 'EXT:examples/Configuration/TsConfig/Page/LinkBrowser/*.tsconfig'
You can find all available options here: RecordLinkHandler page TSconfig options.
When an editor now selects a haiku poem as link it will then be saved
as t3://
in backend link
fields and as
<a href="t3://
in the rich text editor (RTE).
The output of the link needs still to be configured or the link will be removed upon rendering. See the next step:
Frontend: Configure the detail link to the record with TypoScript
For the frontend output of a haiku record link we have to configure the page on which the plugin handling the detail view is displayed and the parameters this plugin expects:
config.recordLinks.haiku {
// Do not force link generation when the record is hidden
forceLink = 0
typolink {
parameter = {$plugin.tx_examples_haiku.settings.singlePid}
additionalParams.data = field:uid
additionalParams.wrap = &tx_examples_haiku[action]=show&tx_examples_haiku[haiku]=|
}
}
You can find the available options here: LinkHandler TypoScript options.