[BUGFIX] Support fragment/section for record links 34/57334/2
authorMathias Brodala <mbrodala@pagemachine.de>
Tue, 10 Oct 2017 10:58:20 +0000 (12:58 +0200)
committerAndreas Wolf <andreas.wolf@typo3.org>
Wed, 11 Jul 2018 08:48:37 +0000 (10:48 +0200)
This allows for setting fragments e.g. by adding a custom recordlist
RecordLinkHandler.

Resolves: #82717
Releases: master, 8.7
Change-Id: I1535a3bb5e446e2f154cd6214e5665887ae6fd0d
Reviewed-on: https://review.typo3.org/57334
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Mathias Brodala <mbrodala@pagemachine.de>
Tested-by: Mathias Brodala <mbrodala@pagemachine.de>
Reviewed-by: Andreas Wolf <andreas.wolf@typo3.org>
Tested-by: Andreas Wolf <andreas.wolf@typo3.org>
typo3/sysext/core/Classes/LinkHandling/RecordLinkHandler.php
typo3/sysext/frontend/Classes/Typolink/DatabaseRecordLinkBuilder.php

index c509dd6..a7de249 100644 (file)
@@ -42,6 +42,10 @@ class RecordLinkHandler implements LinkHandlingInterface
         $urn = $this->baseUrn;
         $urn .= sprintf('?identifier=%s&uid=%s', $parameters['identifier'], $parameters['uid']);
 
+        if (!empty($parameters['fragment'])) {
+            $urn .= sprintf('#%s', $parameters['fragment']);
+        }
+
         return $urn;
     }
 
index 9c9c751..85bf051 100644 (file)
@@ -64,6 +64,10 @@ class DatabaseRecordLinkBuilder extends AbstractTypolinkBuilder
         unset($conf['parameter.']);
         $typoScriptConfiguration = array_replace_recursive($conf, $typoScriptConfiguration);
 
+        if (!empty($linkDetails['fragment'])) {
+            $typoScriptConfiguration['section'] = $linkDetails['fragment'];
+        }
+
         // Build the full link to the record
         $localContentObjectRenderer = GeneralUtility::makeInstance(ContentObjectRenderer::class);
         $localContentObjectRenderer->start($record, $linkHandlerConfiguration['table']);