Followup to #6087: Cleaned up code of IRRE localization
authorOliver Hader <oliver.hader@typo3.org>
Mon, 31 Mar 2008 12:50:05 +0000 (12:50 +0000)
committerOliver Hader <oliver.hader@typo3.org>
Mon, 31 Mar 2008 12:50:05 +0000 (12:50 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@3488 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
t3lib/class.t3lib_befunc.php
t3lib/class.t3lib_tceforms.php
t3lib/class.t3lib_tcemain.php

index 666bc76..49621a4 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,7 @@
        * Fixed bug #7954: XCLASSing ToolbarItem does not work (thanks to Steffen Kamper)
        * Fixed bug #7759: XCLASSing USER_INT objects does not work
        * Cleaned up code of scripts in typo3/classes/
+       * Followup to #6087: Cleaned up code of IRRE localization
 
 2008-03-31  Dmitry Dulepov  <dmitry@typo3.org>
 
index 4edd244..cb98f13 100755 (executable)
@@ -451,22 +451,20 @@ final class t3lib_BEfunc {
         * @return      mixed           Multidimensional array with selected records; if none exist, false is returned
         */
        public function getRecordLocalization($table, $uid, $language, $andWhereClause = '') {
-               $recordLocalization = false; 
-               if (isset($GLOBALS['TCA'][$table]['ctrl'])) {
-                       $tcaCtrl =& $GLOBALS['TCA'][$table]['ctrl'];
-                       if (isset($tcaCtrl['transOrigPointerField']) && isset($tcaCtrl['languageField'])) {
-                               $recordLocalization = t3lib_BEfunc::getRecordsByField(
-                                       $table,
-                                       $tcaCtrl['transOrigPointerField'],
-                                       $uid,
-                                       'AND '.$tcaCtrl['languageField'].'='.intval($language).($andWhereClause ? ' '.$andWhereClause : ''),
-                                       '',
-                                       '',
-                                       '1'
-                               );
-                       }
+               $recordLocalization = false;
+               if (self::isTableLocalizable($table)) {
+                       $tcaCtrl = $GLOBALS['TCA'][$table]['ctrl'];
+                       $recordLocalization = t3lib_BEfunc::getRecordsByField(
+                               $table,
+                               $tcaCtrl['transOrigPointerField'],
+                               $uid,
+                               'AND '.$tcaCtrl['languageField'].'='.intval($language).($andWhereClause ? ' '.$andWhereClause : ''),
+                               '',
+                               '',
+                               '1'
+                       );
                }
-               return $recordLocalization;             
+               return $recordLocalization;
        }
 
 
@@ -849,7 +847,7 @@ final class t3lib_BEfunc {
        public function isTableLocalizable($table) {
                $isLocalizable = false;
                if (isset($GLOBALS['TCA'][$table]['ctrl']) && is_array($GLOBALS['TCA'][$table]['ctrl'])) {
-                       $tcaCtrl =& $GLOBALS['TCA'][$table]['ctrl'];
+                       $tcaCtrl = $GLOBALS['TCA'][$table]['ctrl'];
                        $isLocalizable = (isset($tcaCtrl['languageField']) && $tcaCtrl['languageField'] && isset($tcaCtrl['transOrigPointerField']) && $tcaCtrl['transOrigPointerField']);
                }
                return $isLocalizable;
@@ -861,12 +859,12 @@ final class t3lib_BEfunc {
         * If the table is not prepared for localization or not defined at all in $TCA, false is returned.
         *
         * @param       string          $table: The name of the table to lookup in TCA
-        * @param       mixed           $fieldOrConfig: The fieldname (string) or the configuration of the field to check (array) 
-        * @return      mixed           If table is localizable, the set localizationMode is returned (if property is not set, 'select' is returned by default); if table is not localizable, false is returned 
+        * @param       mixed           $fieldOrConfig: The fieldname (string) or the configuration of the field to check (array)
+        * @return      mixed           If table is localizable, the set localizationMode is returned (if property is not set, 'select' is returned by default); if table is not localizable, false is returned
         */
        public function getInlineLocalizationMode($table, $fieldOrConfig) {
                $localizationMode = false;
-               if (is_array($fieldOrConfig) && count($fieldOrConfig)) {        
+               if (is_array($fieldOrConfig) && count($fieldOrConfig)) {
                        $config = $fieldOrConfig;
                } elseif (is_string($fieldOrConfig) && isset($GLOBALS['TCA'][$table]['columns'][$field]['config'])) {
                        $config = $GLOBALS['TCA'][$table]['columns'][$field]['config'];
@@ -875,7 +873,7 @@ final class t3lib_BEfunc {
                        $localizationMode = (isset($config['behaviour']['localizationMode']) && $config['behaviour']['localizationMode'] ? $config['behaviour']['localizationMode'] : 'select');
                                // The mode 'select' is not possible when child table is not localizable at all:
                        if ($localizationMode=='select' && !self::isTableLocalizable($config['foreign_table'])) {
-                               $localizationMode = false; 
+                               $localizationMode = false;
                        }
                }
                return $localizationMode;
index ae87da6..8102dee 100755 (executable)
@@ -3193,7 +3193,7 @@ class t3lib_TCEforms      {
                        $fCfg = $GLOBALS['TCA'][$table]['columns'][$field];
 
                                // Don't show content if it's for IRRE child records:
-                       if (isset($fCfg['config']['type']) && $fCfg['config']['type']!='inline') {
+                       if ($fCfg['config']['type']!='inline') {
                                if (strcmp($dLVal,''))  {
                                        $item.='<div class="typo3-TCEforms-originalLanguageValue">'.$this->getLanguageIcon($table,$row,0).$this->previewFieldValue($dLVal,$fCfg).'&nbsp;</div>';
                                }
index eaf1335..809b732 100755 (executable)
@@ -2946,7 +2946,7 @@ class t3lib_TCEmain       {
         * @param       array           Record array
         * @param       array           TCA field configuration
         * @param       integer         Real page id (pid) the record is copied to
-        * @param       integer         Language ID (from sys_language table)
+        * @param       integer         Language ID (from sys_language table) used in the duplicated record
         * @return      mixed           Processed value. Normally a string/integer, but can be an array for flexforms!
         * @access private
         * @see copyRecord()