[BUGFIX] Do not show default language record if language visibility setting is set... 29/29329/2
authormxbeer <max-beer@web.de>
Thu, 10 Apr 2014 08:32:33 +0000 (10:32 +0200)
committerStefan Rotsch <stefan.rotsch@aoemedia.de>
Thu, 10 Apr 2014 11:04:54 +0000 (13:04 +0200)
Change-Id: If4b806cc1fecc0fd98737f08b435a46a44ccb07e
Reviewed-on: https://review.typo3.org/29329
Reviewed-by: Stefan Rotsch
Tested-by: Stefan Rotsch
hooks/class.tx_languagevisibility_hooks_t3lib_page.php
tests/tx_languagevisibility_hooks_t3lib_page_testcase.php

index 7213a33..4378181 100644 (file)
@@ -132,6 +132,11 @@ class tx_languagevisibility_hooks_t3lib_page implements t3lib_pageSelect_getPage
         */
        public function getRecordOverlay_postProcess($table, &$row, &$sys_language_content, $OLmode, t3lib_pageSelect $parent) {
 
+               if (is_array($row) && $row['uid'] === 0 && $row['pid'] === 0) {
+                       $row = FALSE;
+                       return;
+               }
+
                if (!tx_languagevisibility_feservices::isSupportedTable($table)
                        || (!is_array($row))
                        || (!isset($row['uid']))
@@ -139,11 +144,6 @@ class tx_languagevisibility_hooks_t3lib_page implements t3lib_pageSelect_getPage
                        return;
                }
 
-               if ($row['uid'] === 0 && $row['pid'] === 0) {
-                       $row = FALSE;
-                       return;
-               }
-
                try {
                        $element = tx_languagevisibility_feservices::getElement($row['uid'], $table);
                        $overlayLanguage = tx_languagevisibility_feservices::getOverlayLanguageIdForElement($element, $sys_language_content);
index faeb8e8..55e875f 100644 (file)
@@ -76,7 +76,7 @@ class tx_languagevisibility_hooks_t3lib_page_ttcontent_testcase extends tx_langu
                        $this->assertEquals(
                                FALSE,
                                $overlayedRow,
-                               sprintf('record with id %d is removed in language %d', $uid, $language)
+                               sprintf('record with id %d is removed or not visible in language %d', $uid, $language)
                        );
                } elseif (array_key_exists('_LOCALIZED_UID', $overlayedRow)) {
                        $this->assertSame(
@@ -101,6 +101,7 @@ class tx_languagevisibility_hooks_t3lib_page_ttcontent_testcase extends tx_langu
                        array(19, 1, '19',  '"forcedToYes" without translation'),
                        array(20, 1, '21',  '"forcedToYes" with translation'),
                        array(20, 2, '21',  '"forcedToYes" with translation in fallback'),
+                       array(22, 0, NULL,  '"forcedToNo" without translation (default language)'),
                        array(22, 3, NULL,  '"forcedToNo" without translation'),
                        array(22, 1, NULL,  '"forcedToNo" with translation'),
                        array(22, 2, NULL,  '"forcedToNo" with translation in fallback'),