[BUGFIX] Allow config.linkVars to be added for linking to pages with site config 97/58097/2
authorBenni Mack <benni@typo3.org>
Fri, 31 Aug 2018 08:33:14 +0000 (10:33 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Sat, 1 Sep 2018 12:27:57 +0000 (14:27 +0200)
Due to the refactoring yesterday, the TypoScript option
config.linkVars was removed, but is still a valid use-case to be added.

Resolves: #86054
Releases: master
Change-Id: I6d42c82f474668b62143982b8d9f2adf9b735935
Reviewed-on: https://review.typo3.org/58097
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Frans Saris <franssaris@gmail.com>
Tested-by: Frans Saris <franssaris@gmail.com>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/sysext/frontend/Classes/Typolink/PageLinkBuilder.php

index 90aa362..adc9487 100644 (file)
@@ -181,6 +181,14 @@ class PageLinkBuilder extends AbstractTypolinkBuilder
         if ($siteOfTargetPage instanceof Site) {
             $queryParameters = [];
             parse_str($addQueryParams, $queryParameters);
+            // get config.linkVars and prepend
+            if ($tsfe->linkVars) {
+                $globalQueryParameters = [];
+                parse_str($tsfe->linkVars, $globalQueryParameters);
+                if (!empty($globalQueryParameters)) {
+                    $queryParameters = array_merge_recursive($globalQueryParameters, $queryParameters);
+                }
+            }
             unset($queryParameters['id'], $queryParameters['L']);
             if ($pageType) {
                 $queryParameters['type'] = (int)$pageType;