[BUGFIX] DatabaseRecordLinkBuilder respect now other typoscript settings 69/56069/2
authorRené Pflamm <rene.pflamm@gmail.com>
Mon, 22 Jan 2018 15:02:04 +0000 (16:02 +0100)
committerChristian Kuhn <lolli@schwarzbu.ch>
Thu, 8 Mar 2018 21:44:50 +0000 (22:44 +0100)
If typolinks are generated using LinkHandler, the values defined in
typoscript (such as classes and titles) are now retained.

Resolves: #81903
Releases: master, 8.7
Change-Id: I9ec63e2cf972a3c4e7439b9259c63e2ab9b4b60d
Reviewed-on: https://review.typo3.org/56069
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/sysext/frontend/Classes/Typolink/DatabaseRecordLinkBuilder.php

index e1920c2..1c3e40e 100644 (file)
@@ -34,7 +34,7 @@ class DatabaseRecordLinkBuilder extends AbstractTypolinkBuilder
         $configuration = $tsfe->tmpl->setup['config.']['recordLinks.'];
         $linkHandlerConfiguration = $pageTsConfig['TCEMAIN.']['linkHandler.'];
 
-        if (!isset($configuration[$configurationKey]) || !isset($linkHandlerConfiguration[$configurationKey])) {
+        if (!isset($configuration[$configurationKey]$linkHandlerConfiguration[$configurationKey])) {
             throw new UnableToLinkException(
                 'Configuration how to link "' . $linkDetails['typoLinkParameter'] . '" was not found, so "' . $linkText . '" was not linked.',
                 1490989149,
@@ -59,6 +59,11 @@ class DatabaseRecordLinkBuilder extends AbstractTypolinkBuilder
             );
         }
 
+        // Unset the parameter part of the given TypoScript configuration while keeping
+        // config that has been set in addition.
+        unset($conf['parameter.']);
+        $typoScriptConfiguration = array_merge_recursive($typoScriptConfiguration, $conf);
+
         // Build the full link to the record
         $localContentObjectRenderer = GeneralUtility::makeInstance(ContentObjectRenderer::class);
         $localContentObjectRenderer->start($record, $linkHandlerConfiguration['table']);