[BUGFIX] Add &L=0 to Indexed Search results only when needed. 78/54178/2
authorŁukasz Uznański <l.uznanski@macopedia.pl>
Thu, 7 Sep 2017 20:44:21 +0000 (22:44 +0200)
committerSusanne Moog <susanne.moog@typo3.org>
Wed, 20 Sep 2017 10:48:11 +0000 (12:48 +0200)
L=0 is added to Indexed Search results links if current page language is
> 0.

Resolves: #81164
Related: #81994
Related: #81986
Releases: master, 8.7
Change-Id: Ia9738b4d64bdcf1f3b2d6fa91d446f2f22c8130b
Reviewed-on: https://review.typo3.org/54178
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Stefan Neufeind <typo3.neufeind@speedpartner.de>
Tested-by: Stefan Neufeind <typo3.neufeind@speedpartner.de>
Reviewed-by: Susanne Moog <susanne.moog@typo3.org>
Tested-by: Susanne Moog <susanne.moog@typo3.org>
typo3/sysext/indexed_search/Classes/Controller/SearchController.php

index d90509a..8920274 100644 (file)
@@ -1308,13 +1308,16 @@ class SearchController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionControlle
      */
     protected function linkPage($pageUid, $linkText, $row = [], $markUpSwParams = [])
     {
+        $pageLanguage = $GLOBALS['TSFE']->sys_language_content;
         // Parameters for link
         $urlParameters = (array)unserialize($row['cHashParams']);
         // Add &type and &MP variable:
         if ($row['data_page_mp']) {
             $urlParameters['MP'] = $row['data_page_mp'];
         }
-        $urlParameters['L'] = (int)$row['sys_language_uid'];
+        if (($pageLanguage === 0 && $row['sys_language_uid'] > 0) || $pageLanguage > 0) {
+            $urlParameters['L'] = (int)$row['sys_language_uid'];
+        }
         // markup-GET vars:
         $urlParameters = array_merge($urlParameters, $markUpSwParams);
         // This will make sure that the path is retrieved if it hasn't been