[FEATURE] Hide translated records from List module
authorStefan Geith <typo3dev2011@geithware.de>
Tue, 12 Jul 2011 15:27:37 +0000 (17:27 +0200)
committerSteffen Gebert <steffen.gebert@typo3.org>
Sun, 31 Jul 2011 18:39:28 +0000 (20:39 +0200)
Add the new TSconfig option
  mod.web_list.hideTranslations = *
or
  mod.web_list.hideTranslations = list,of,tables

For those tables, only the records of the default language are shown in
the List module. All translations are hidden.

The 'Localization view', still shows all records, including translated
records.

Change-Id: Iede6697a8ee28155b9fd62153eb7299f738258e6
Resolves: #23198
Releases: 4.6
Reviewed-on: http://review.typo3.org/3289
Reviewed-by: Steffen Gebert
Tested-by: Steffen Gebert
typo3/class.db_list.inc
typo3/sysext/recordlist/mod1/index.php

index b0ae15a..7d6a3a5 100644 (file)
@@ -87,6 +87,13 @@ class recordList extends t3lib_recordList {
        var $modSharedTSconfig = array();               // Shared module configuration, used by localization features
        var $pageRecord = array();              // Loaded with page record with version overlay if any.
        var $hideTables = '';                   // Tables which should not get listed
+
+       /**
+        * Tables which should not list their translations
+        * @var $hideTranslations string
+        */
+       public $hideTranslations = '';
+
        var $tableTSconfigOverTCA = array(); //TSconfig which overwrites TCA-Settings
        var $tablesCollapsed = array(); // Array of collapsed / uncollapsed tables in multi table view
 
@@ -489,6 +496,12 @@ class recordList extends t3lib_recordList {
                        'LIMIT' => $limit
                );
 
+                       // Filter out records that are translated, if TSconfig mod.web_list.hideTranslations is set
+               if ((in_array($table, t3lib_div::trimExplode(',', $this->hideTranslations)) || $this->hideTranslations === '*')
+                       && !empty($GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField'])) {
+                       $queryParts['WHERE'] .= ' AND ' . $GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField'] . '=0 ';
+               }
+
                        // Apply hook as requested in http://bugs.typo3.org/view.php?id=4361
                foreach ($hookObjectsArr as $hookObj) {
                        if (method_exists($hookObj, 'makeQueryArray_post')) {
index 8bd2f6a..316a6f4 100644 (file)
@@ -217,6 +217,7 @@ class SC_db_list {
                $dblist->disableSingleTableView = $this->modTSconfig['properties']['disableSingleTableView'];
                $dblist->listOnlyInSingleTableMode = $this->modTSconfig['properties']['listOnlyInSingleTableView'];
                $dblist->hideTables = $this->modTSconfig['properties']['hideTables'];
+               $dblist->hideTranslations = $this->modTSconfig['properties']['hideTranslations'];
                $dblist->tableTSconfigOverTCA = $this->modTSconfig['properties']['table.'];
                $dblist->clickTitleMode = $this->modTSconfig['properties']['clickTitleMode'];
                $dblist->alternateBgColors=$this->modTSconfig['properties']['alternateBgColors']?1:0;