Feature: #79121 - Implement hook in typolink for modification of page params¶
See forge#79121
Description¶
A new hook has been implemented in ContentObjectRenderer::typoLink for links to pages. With this hook you can modify the link configuration, for example enriching it with additional parameters or meta data from the page row.
Impact¶
You can now register a hook via:
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typolinkProcessing']['typolinkModifyParameterForPageLinks'][] = \Your\Namespace\Hooks\MyBeautifulHook::class;
Your hook has to implement TypolinkModifyLinkConfigForPageLinksHookInterface
with its method
modifyPageLinkConfiguration(array $linkConfiguration, array $linkDetails, array $pageRow)
.
In $linkConfiguration
you get the configuration array for the link - this is what your hook
can modify and has to return.
$linkDetails
contains additional information for your link and $pageRow
is the full
database row of the page.
For more information as to which configuration options may be changed, see TSRef.
Example implementation:¶
public function modifyPageLinkConfiguration(array $linkConfiguration, array $linkDetails, array $pageRow) : array
{
$linkConfiguration['additionalParams'] .= $pageRow['myAdditionalParamsField'];
return $linkConfiguration;
}