test_modifications_6-2-27.txt

GRiDDS GmbH, 2016-10-14 13:34

Download (29.9 KB)

 
1
diff --git a/typo3/sysext/extbase/Classes/Persistence/Generic/Storage/Typo3DbBackend.php b/typo3/sysext/extbase/Classes/Persistence/Generic/Storage/Typo3DbBackend.php
2
index b16bd1e..cda3cdb 100644
3
--- a/typo3/sysext/extbase/Classes/Persistence/Generic/Storage/Typo3DbBackend.php
4
+++ b/typo3/sysext/extbase/Classes/Persistence/Generic/Storage/Typo3DbBackend.php
5
@@ -823,7 +823,9 @@ class Typo3DbBackend implements BackendInterface, \TYPO3\CMS\Core\SingletonInter
6
 			) {
7
 				if (in_array($row[$GLOBALS['TCA'][$tableName]['ctrl']['languageField']], array(-1, 0))) {
8
 					$overlayMode = $querySettings->getLanguageMode() === 'strict' ? 'hideNonTranslated' : '';
9
-					$row = $pageRepository->getRecordOverlay($tableName, $row, $querySettings->getLanguageUid(), $overlayMode);
10
+					// gridds replaced (one line)
11
+					// $row = $pageRepository->getRecordOverlay($tableName, $row, $querySettings->getLanguageUid(), $overlayMode);
12
+					$row = $pageRepository->getRecordOverlayWithoutFallback($tableName, $row, $querySettings->getSysLanguageUid(), $overlayMode);
13
 				}
14
 			}
15
 			if ($row !== NULL && is_array($row)) {
16
diff --git a/typo3/sysext/frontend/Classes/ContentObject/ContentContentObject.php b/typo3/sysext/frontend/Classes/ContentObject/ContentContentObject.php
17
index dddd02e..379cc50 100644
18
--- a/typo3/sysext/frontend/Classes/ContentObject/ContentContentObject.php
19
+++ b/typo3/sysext/frontend/Classes/ContentObject/ContentContentObject.php
20
@@ -83,7 +83,30 @@ class ContentContentObject extends \TYPO3\CMS\Frontend\ContentObject\AbstractCon
21
 						if ($conf['table'] == 'pages') {
22
 							$row = $GLOBALS['TSFE']->sys_page->getPageOverlay($row);
23
 						} else {
24
-							$row = $GLOBALS['TSFE']->sys_page->getRecordOverlay($conf['table'], $row, $GLOBALS['TSFE']->sys_language_content, $GLOBALS['TSFE']->sys_language_contentOL);
25
+							// gridds removed (one line)
26
+							// $row = $GLOBALS['TSFE']->sys_page->getRecordOverlay($conf['table'], $row, $GLOBALS['TSFE']->sys_language_content, $GLOBALS['TSFE']->sys_language_contentOL);
27
+							
28
+							// gridds added (start)
29
+
30
+                                                               $fallbackChain = NULL;
31
+                                                               if (isset($conf['languageFallbackChain'])) {
32
+                                                                       $fallbackChain = \TYPO3\CMS\Core\Utility\GeneralUtility::intExplode(
33
+                                                                               ',', $conf['languageFallbackChain']
34
+                                                                       );
35
+                                                               }
36
+
37
+                                                               $pageLanguageBinding = TRUE;
38
+                                                               if (isset($conf['respectPageLanguageBinding']) &&
39
+                                                                       $conf['respectPageLanguageBinding'] == '0'
40
+                                                               ) {
41
+                                                                       $pageLanguageBinding = FALSE;
42
+                                                               }
43
+
44
+                                                               $row = $GLOBALS['TSFE']->sys_page->getRecordOverlayWithFallback(
45
+                                                                       $conf['table'], $row, NULL, NULL, $fallbackChain, $pageLanguageBinding
46
+                                                               );
47
+							// gridds added (end)
48
+
49
 						}
50
 					}
51
 					// Might be unset in the sys_language_contentOL
52
diff --git a/typo3/sysext/frontend/Classes/ContentObject/Menu/AbstractMenuContentObject.php b/typo3/sysext/frontend/Classes/ContentObject/Menu/AbstractMenuContentObject.php
53
index 40f83ad..b19d0d2 100644
54
--- a/typo3/sysext/frontend/Classes/ContentObject/Menu/AbstractMenuContentObject.php
55
+++ b/typo3/sysext/frontend/Classes/ContentObject/Menu/AbstractMenuContentObject.php
56
@@ -994,7 +994,10 @@ class AbstractMenuContentObject {
57
 							$tok = TRUE;
58
 							// There is an alternative language active AND the current page requires a translation:
59
 							if ($GLOBALS['TSFE']->sys_language_uid && GeneralUtility::hideIfNotTranslated($data['l18n_cfg'])) {
60
-								if (!$data['_PAGES_OVERLAY']) {
61
+								// gridds removed (one line)
62
+								// if (!$data['_PAGES_OVERLAY']) {
63
+								// gridds added (one line)
64
+								if (!$data['_PAGES_OVERLAY'] || ($data['_PAGES_OVERLAY_LANGUAGE'] != $data['sys_language_uid'])) {
65
 									$tok = FALSE;
66
 								}
67
 							}
68
@@ -1880,7 +1883,9 @@ class AbstractMenuContentObject {
69
 		while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($resource)) {
70
 			$this->sys_page->versionOL('tt_content', $row);
71
 			if ($GLOBALS['TSFE']->sys_language_contentOL && $basePageRow['_PAGES_OVERLAY_LANGUAGE']) {
72
-				$row = $this->sys_page->getRecordOverlay('tt_content', $row, $basePageRow['_PAGES_OVERLAY_LANGUAGE'], $GLOBALS['TSFE']->sys_language_contentOL);
73
+				// gridds replaced (one line)
74
+				// $row = $this->sys_page->getRecordOverlay('tt_content', $row, $basePageRow['_PAGES_OVERLAY_LANGUAGE'], $GLOBALS['TSFE']->sys_language_contentOL);
75
+				$row = $this->sys_page->getRecordOverlayWithFallback('tt_content', $row, $basePageRow['_PAGES_OVERLAY_LANGUAGE']);
76
 			}
77
 			if ($this->mconf['sectionIndex.']['type'] !== 'all') {
78
 				$doIncludeInSectionIndex = $row['sectionIndex'] >= 1;
79
diff --git a/typo3/sysext/frontend/Classes/ContentObject/RecordsContentObject.php b/typo3/sysext/frontend/Classes/ContentObject/RecordsContentObject.php
80
index e130814..25489a4 100644
81
--- a/typo3/sysext/frontend/Classes/ContentObject/RecordsContentObject.php
82
+++ b/typo3/sysext/frontend/Classes/ContentObject/RecordsContentObject.php
83
@@ -97,7 +97,39 @@ class RecordsContentObject extends AbstractContentObject {
84
 							if ($val['table'] === 'pages') {
85
 								$row = $GLOBALS['TSFE']->sys_page->getPageOverlay($row);
86
 							} else {
87
-								$row = $GLOBALS['TSFE']->sys_page->getRecordOverlay($val['table'], $row, $GLOBALS['TSFE']->sys_language_content, $GLOBALS['TSFE']->sys_language_contentOL);
88
+								// gridds removed (one line)
89
+								// $row = $GLOBALS['TSFE']->sys_page->getRecordOverlay($val['table'], $row, $GLOBALS['TSFE']->sys_language_content, $GLOBALS['TSFE']->sys_language_contentOL);
90
+							
91
+								// gridds added (start)
92
+
93
+
94
+                                               $fallbackChain = NULL;
95
+                                               if (isset($conf['languageFallbackChain'])) {
96
+                                                       $fallbackChain = \TYPO3\CMS\Core\Utility\GeneralUtility::intExplode(
97
+                                                               ',', $conf['languageFallbackChain']
98
+                                                       );
99
+                                               }
100
+
101
+                                               $pageLanguageBinding = TRUE;
102
+                                               if (isset($conf['respectPageLanguageBinding']) &&
103
+                                                       $conf['respectPageLanguageBinding'] == '0'
104
+                                               ) {
105
+                                                       $pageLanguageBinding = FALSE;
106
+                                               }
107
+
108
+                                               $row = $GLOBALS['TSFE']->sys_page->getRecordOverlayWithFallback(
109
+                                                       $conf['table'], $row, NULL, NULL, $fallbackChain, $pageLanguageBinding
110
+                                               );
111
+
112
+
113
+
114
+								// gridds added (end)
115
+
116
+
117
+
118
+
119
+
120
+
121
 							}
122
 						}
123
 					}
124
diff --git a/typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php b/typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php
125
index 8129870..aa318ab 100644
126
--- a/typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php
127
+++ b/typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php
128
@@ -657,6 +657,28 @@ class TypoScriptFrontendController {
129
 	 */
130
 	public $sys_language_content = 0;
131
 
132
+
133
+	// gridds added (start)
134
+
135
+       /**
136
+        * Contains the prioritized language fallback chain
137
+        *
138
+        * @var array
139
+        */
140
+       public $languageFallbackChain = array();
141
+
142
+       /**
143
+        * Contains the prioritized language fallback chain for the current page
144
+        *
145
+        * @var array
146
+        */
147
+       public $languageFallbackChainWithPageLanguageBinding = array();
148
+
149
+
150
+	// gridds added (end)
151
+
152
+
153
+
154
 	/**
155
 	 * Site content overlay flag; If set - and sys_language_content is > 0 - ,
156
 	 * records selected will try to look for a translation pointing to their uid. (If
157
@@ -2730,11 +2752,24 @@ class TypoScriptFrontendController {
158
 		$this->initLLvars();
159
 
160
 		// Get values from TypoScript:
161
-		$this->sys_language_uid = ($this->sys_language_content = (int)$this->config['config']['sys_language_uid']);
162
-		list($this->sys_language_mode, $sys_language_content) = GeneralUtility::trimExplode(';', $this->config['config']['sys_language_mode']);
163
+
164
+		// gridds removed (start)
165
+		// $this->sys_language_uid = ($this->sys_language_content = (int)$this->config['config']['sys_language_uid']);
166
+		// list($this->sys_language_mode, $sys_language_content) = GeneralUtility::trimExplode(';', $this->config['config']['sys_language_mode']);
167
+		// gridds removed (end)
168
+
169
+		// gridds added (start)
170
+$this->sys_language_uid = $this->sys_language_content = intval($this->config['config']['sys_language_uid']);
171
+list($this->sys_language_mode, $_) = GeneralUtility::trimExplode(';', $this->config['config']['sys_language_mode']);
172
+$languageFallbackChain = GeneralUtility::intExplode(',', $this->config['config']['languageFallbackChain']);
173
+		// gridds added (end)
174
+
175
 		$this->sys_language_contentOL = $this->config['config']['sys_language_overlay'];
176
 		// If sys_language_uid is set to another language than default:
177
-		if ($this->sys_language_uid > 0) {
178
+
179
+		// gridds replaced (one line)
180
+		// if ($this->sys_language_uid > 0) {
181
+		if ($this->sys_language_uid) {
182
 			// check whether a shortcut is overwritten by a translated page
183
 			// we can only do this now, as this is the place where we get
184
 			// to know about translations
185
@@ -2753,14 +2788,42 @@ class TypoScriptFrontendController {
186
 								$this->pageNotFoundAndExit('Page is not available in the requested language (strict).');
187
 								break;
188
 							case 'content_fallback':
189
-								$fallBackOrder = GeneralUtility::intExplode(',', $sys_language_content);
190
-								foreach ($fallBackOrder as $orderValue) {
191
-									if ((string)$orderValue === '0' || count($this->sys_page->getPageOverlay($this->id, $orderValue))) {
192
-										$this->sys_language_content = $orderValue;
193
-										// Setting content uid (but leaving the sys_language_uid)
194
-										break;
195
-									}
196
-								}
197
+								// gridds removed (start)
198
+								// $fallBackOrder = GeneralUtility::intExplode(',', $sys_language_content);
199
+								// foreach ($fallBackOrder as $orderValue) {
200
+								// 	if ((string)$orderValue === '0' || count($this->sys_page->getPageOverlay($this->id, $orderValue))) {
201
+								// 		$this->sys_language_content = $orderValue;
202
+								// 		// Setting content uid (but leaving the sys_language_uid)
203
+								// 		break;
204
+								// 	}
205
+								// }
206
+								
207
+								// gridds added (start)
208
+
209
+
210
+                                                               // default is to fallback to default language
211
+                                                               $this->sys_language_content = 0;
212
+
213
+                                                               foreach ($languageFallbackChain as $languageId) {
214
+                                                                   // ignore default language
215
+                                                                       if ($this->sys_language_uid === $languageId || $languageId <= 0) {
216
+                                                                               continue;
217
+                                                                       }
218
+
219
+                                                                       $pageOverlay = $this->sys_page->getPageOverlay($this->id, $languageId);
220
+                                                                       if (count($pageOverlay)) {
221
+                                                                                // Setting content uid (but leaving the sys_language_uid)
222
+                                                                               $this->sys_language_content = $languageId;
223
+                                                                               // Remove all fields from page overlay which do not exist in $this->page
224
+                                                                               $pageOverlay = array_intersect_key($pageOverlay, $this->page);
225
+                                                                               // overlay page with existing page overlay
226
+                                                                               $this->page = array_merge($this->page, $pageOverlay);
227
+
228
+                                                                                break;
229
+                                                                        }
230
+                                                                }
231
+
232
+								// gridds added (end)
233
 								break;
234
 							case 'ignore':
235
 								$this->sys_language_content = $this->sys_language_uid;
236
@@ -2768,18 +2831,71 @@ class TypoScriptFrontendController {
237
 							default:
238
 								// Default is that everything defaults to the default language...
239
 								$this->sys_language_uid = ($this->sys_language_content = 0);
240
+								// gridds added (one line)
241
+								break;
242
 						}
243
 					}
244
 				}
245
 			} else {
246
 				// Setting sys_language if an overlay record was found (which it is only if a language is used)
247
-				$this->page = $this->sys_page->getPageOverlay($this->page, $this->sys_language_uid);
248
+				// gridds removed (one line)
249
+				// $this->page = $this->sys_page->getPageOverlay($this->page, $this->sys_language_uid);
250
+			
251
+
252
+
253
+				// gridds added (start)
254
+
255
+
256
+                               // Remove all fields from page overlay which do not exist in $this->page
257
+                               $olRec = array_intersect_key($olRec, $this->page);
258
+
259
+                               // overlay page with existing page overlay
260
+                               $this->page = array_merge($this->page, $olRec);
261
+
262
+				// gridds added (end)
263
 			}
264
+
265
+
266
+			// gridds added (start)
267
+                       // calculate the language fallback chains
268
+                       if ($this->sys_language_mode === 'content_fallback') {
269
+                               $this->languageFallbackChain = $languageFallbackChain;
270
+                               foreach ($languageFallbackChain as $languageId) {
271
+                                       // ignore default language
272
+                                       if ($this->sys_language_uid === $languageId) {
273
+                                               continue;
274
+                                       }
275
+
276
+                                       $this->languageFallbackChain[] = $languageId;
277
+                                       if (count($this->sys_page->getPageOverlay($this->id, $languageId))) {
278
+                                               $this->languageFallbackChainWithPageLanguageBinding[] = $languageId;
279
+                                       }
280
+                               }
281
+                        }
282
+			// gridds added (end)
283
+
284
+
285
+
286
+
287
 		}
288
+
289
+
290
+
291
+
292
+
293
 		// Setting sys_language_uid inside sys-page:
294
 		$this->sys_page->sys_language_uid = $this->sys_language_uid;
295
+		// gridds removed (start)
296
+		// // If default translation is not available:
297
+		// if ((!$this->sys_language_uid || !$this->sys_language_content) && GeneralUtility::hideIfDefaultLanguage($this->page['l18n_cfg'])) {
298
+		// gridds removed (end)
299
+
300
+		// gridds added (start)
301
+		
302
 		// If default translation is not available:
303
-		if ((!$this->sys_language_uid || !$this->sys_language_content) && GeneralUtility::hideIfDefaultLanguage($this->page['l18n_cfg'])) {
304
+		if ((!$this->sys_language_uid || !$this->sys_language_content) && $this->page['l18n_cfg'] & 1) {
305
+		
306
+		// gridds added (end)
307
 			$message = 'Page is not available in default language.';
308
 			GeneralUtility::sysLog($message, 'cms', GeneralUtility::SYSLOG_SEVERITY_ERROR);
309
 			$this->pageNotFoundAndExit($message);
310
diff --git a/typo3/sysext/frontend/Classes/Page/PageRepository.php b/typo3/sysext/frontend/Classes/Page/PageRepository.php
311
index 9d44964..a7ef85b 100644
312
--- a/typo3/sysext/frontend/Classes/Page/PageRepository.php
313
+++ b/typo3/sysext/frontend/Classes/Page/PageRepository.php
314
@@ -16,6 +16,9 @@ namespace TYPO3\CMS\Frontend\Page;
315
 
316
 use TYPO3\CMS\Core\Utility\GeneralUtility;
317
 use TYPO3\CMS\Core\Versioning\VersionState;
318
+// gridds added (one line)
319
+use TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController;
320
+
321
 
322
 /**
323
  * Page functions, a lot of sql/pages-related functions
324
@@ -341,7 +344,14 @@ class PageRepository {
325
 	 */
326
 	public function getPageOverlay($pageInput, $lUid = -1) {
327
 		// Initialize:
328
+
329
+		// gridds added (one line)
330
+		$noSpecialLanguageRequested = FALSE;
331
+
332
 		if ($lUid < 0) {
333
+			// gridds added (one line)
334
+			$noSpecialLanguageRequested = TRUE;
335
+
336
 			$lUid = $this->sys_language_uid;
337
 		}
338
 		$row = NULL;
339
@@ -367,6 +377,22 @@ class PageRepository {
340
 				$page_id = $pageInput;
341
 			}
342
 			if (count($fieldArr)) {
343
+				// gridds added (start)
344
+								$languageClause = 'sys_language_uid=' . intval($lUid) . ' ';
345
+								
346
+								$languageList = array();
347
+								if ($noSpecialLanguageRequested) {
348
+										$languageList = array_unique(array_merge(
349
+												array($lUid),
350
+												$GLOBALS['TSFE']->languageFallbackChain,
351
+												array($GLOBALS['TSFE']->sys_language_content)
352
+										));
353
+
354
+										$languageIds = implode(',', array_map('intval', $languageList));
355
+										$languageClause = 'sys_language_uid IN (' . $languageIds . ') ';
356
+								}
357
+				// gridds added (end)
358
+
359
 				// NOTE to enabledFields('pages_language_overlay'):
360
 				// Currently the showHiddenRecords of TSFE set will allow
361
 				// pages_language_overlay records to be selected as they are
362
@@ -374,9 +400,47 @@ class PageRepository {
363
 				// However you may argue that the showHiddenField flag should
364
 				// determine this. But that's not how it's done right now.
365
 				// Selecting overlay record:
366
-				$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(implode(',', $fieldArr), 'pages_language_overlay', 'pid=' . (int)$page_id . '
367
-								AND sys_language_uid=' . (int)$lUid . $this->enableFields('pages_language_overlay'), '', '', '1');
368
-				$row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res);
369
+				
370
+				// gridds removed (start)
371
+				// $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(implode(',', $fieldArr), 'pages_language_overlay', 'pid=' . (int)$page_id . '
372
+				//				AND sys_language_uid=' . (int)$lUid . $this->enableFields('pages_language_overlay'), '', '', '1');
373
+				// $row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res);
374
+				// gridds removed (end)
375
+
376
+				// gridds added (start)
377
+								if (!in_array('sys_language_uid', $fieldArr)) {
378
+										$fieldArr[] = 'sys_language_uid';
379
+								}
380
+								$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
381
+										implode(',', $fieldArr),
382
+										'pages_language_overlay',
383
+										'pid=' . intval($page_id) .
384
+												' AND ' . $languageClause .
385
+												$this->enableFields('pages_language_overlay'),
386
+										'',
387
+										'',
388
+										2
389
+								);
390
+
391
+								if ($noSpecialLanguageRequested) {
392
+										// Fetch the row and prefer the most recent in the fallback priority list starting with the lUid
393
+										$firstRow = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res);
394
+										$secondRow = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res);
395
+										foreach ($languageList as $languageId) {
396
+												if ($firstRow['sys_language_uid'] == $languageId) {
397
+														$row = $firstRow;
398
+														break;
399
+
400
+												} elseif ($secondRow['sys_language_uid'] == $languageId) {
401
+														$row = $secondRow;
402
+														break;
403
+												}
404
+										}
405
+								} else {
406
+										$row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res);
407
+								}
408
+				// gridds added (end)
409
+
410
 				$GLOBALS['TYPO3_DB']->sql_free_result($res);
411
 				$this->versionOL('pages_language_overlay', $row);
412
 				if (is_array($row)) {
413
@@ -408,19 +472,103 @@ class PageRepository {
414
 		}
415
 	}
416
 
417
-	/**
418
-	 * Creates language-overlay for records in general (where translation is found
419
-	 * in records from the same table)
420
-	 *
421
-	 * @param string $table Table name
422
-	 * @param array $row Record to overlay. Must containt uid, pid and $table]['ctrl']['languageField']
423
-	 * @param integer $sys_language_content Pointer to the sys_language uid for content on the site.
424
-	 * @param string $OLmode Overlay mode. If "hideNonTranslated" then records without translation will not be returned  un-translated but unset (and return value is FALSE)
425
-	 * @throws \UnexpectedValueException
426
-	 * @return mixed Returns the input record, possibly overlaid with a translation.  But if $OLmode is "hideNonTranslated" then it will return FALSE if no translation is found.
427
-	 * @todo Define visibility
428
-	 */
429
-	public function getRecordOverlay($table, $row, $sys_language_content, $OLmode = '') {
430
+// gridds added (start)
431
+
432
+
433
+       /**
434
+        * Creates a language overlay for records stored inside tables which contain the
435
+        * translation information themselves. In addition to getRecordOverlay this method
436
+        * also checks for specified content language fallbacks and includes them.
437
+        *
438
+        * @param string $table Table name
439
+        * @param array $row Record to overlay. Must contain uid, pid and $table]['ctrl']['languageField']
440
+        * @param integer|null $sys_language_content Pointer to the sys_language uid for content on the site.
441
+        * @param string|null $OLmode Overlay mode. If "hideNonTranslated" then records without translation will not be returned un-translated but unset (and return value is FALSE)
442
+        * @param array|null $fallbackList ordered fallback list of language ids
443
+        * @param bool $pageLanguageBinding use page language binding for the language fallback chain (only used if fallbackList is NULL)
444
+        * @return mixed Returns the input record, possibly overlaid with a translation. But if $OLmode is "hideNonTranslated" then it will return FALSE if no translation is found.
445
+        */
446
+       public function getRecordOverlayWithFallback(
447
+               $table, $row, $sys_language_content = NULL, $OLmode = NULL, $fallbackList = NULL, $pageLanguageBinding = TRUE
448
+       ) {
449
+               /** @var TypoScriptFrontendController $tsfe */
450
+               $tsfe = $GLOBALS['TSFE'];
451
+               $sys_language_content = ($sys_language_content !== NULL ? $sys_language_content : $tsfe->sys_language_content);
452
+               $OLmode = ($OLmode !== NULL ? $OLmode: $tsfe->sys_language_contentOL);
453
+               if ($fallbackList === NULL) {
454
+                       $fallbackList = $tsfe->languageFallbackChainWithPageLanguageBinding;
455
+                       if (!$pageLanguageBinding) {
456
+                               $fallbackList = $tsfe->languageFallbackChain;
457
+                       }
458
+               }
459
+
460
+               $record = $this->getRecordOverlayWithoutFallback($table, $row, $sys_language_content, $OLmode);
461
+               if (!is_array($record) || !isset($record['_LOCALIZED_UID'])) {
462
+                       if (count($fallbackList) && $sys_language_content && $OLmode !== 'hideNonTranslated') {
463
+                               foreach ($fallbackList as $fallbackId) {
464
+                                       $record = $this->getRecordOverlayWithoutFallback($table, $row, $fallbackId, $OLmode);
465
+                                       if (is_array($record) && isset($record['_LOCALIZED_UID'])) {
466
+                                               break;
467
+                                       }
468
+                               }
469
+                       }
470
+               }
471
+               return $record;
472
+       }
473
+
474
+       /**
475
+        * Creates a language overlay for records stored inside tables which contain the
476
+        * translation information themselves.
477
+        *
478
+        * @param string $table Table name the record comes from
479
+        * @param array $row Record to overlay. Must contain the columns uid, pid and $TCA[$table]['ctrl']['languageField']
480
+        * @param integer $sys_language_content Pointer to the sys_language uid to use for content.
481
+         * @param string $OLmode Overlay mode. If "hideNonTranslated" then records without translation will not be returned un-translated but unset (and return value is FALSE)
482
+         * @return mixed Returns the input record, possibly overlaid with a translation. But if $OLmode is "hideNonTranslated" then it will return FALSE if no translation is found.
483
+        * @deprecated since 6.2; will be removed two versions later
484
+         */
485
+        public function getRecordOverlay($table, $row, $sys_language_content, $OLmode = '') {
486
+               GeneralUtility::logDeprecatedFunction();
487
+               return $this->getRecordOverlayWithoutFallback($table, $row, $sys_language_content, $OLmode);
488
+       }
489
+
490
+
491
+
492
+// gridds added (end)
493
+
494
+
495
+// gridds removed (start)
496
+//	/**
497
+//	 * Creates language-overlay for records in general (where translation is found
498
+//	 * in records from the same table)
499
+//	 *
500
+//	 * @param string $table Table name
501
+//	 * @param array $row Record to overlay. Must containt uid, pid and $table]['ctrl']['languageField']
502
+//	 * @param integer $sys_language_content Pointer to the sys_language uid for content on the site.
503
+//	 * @param string $OLmode Overlay mode. If "hideNonTranslated" then records without translation will not be returned  un-translated but unset (and return value is FALSE)
504
+//	 * @throws \UnexpectedValueException
505
+//	 * @return mixed Returns the input record, possibly overlaid with a translation.  But if $OLmode is "hideNonTranslated" then it will return FALSE if no translation is found.
506
+//	 * @todo Define visibility
507
+//	 */
508
+//	public function getRecordOverlay($table, $row, $sys_language_content, $OLmode = '') {
509
+// gridds removed (end)
510
+
511
+// gridds added (start)
512
+
513
+       /**
514
+        * Creates a language overlay for records stored inside tables which contain the
515
+        * translation information themselves.
516
+        *
517
+        * @throws \UnexpectedValueException
518
+        * @param string $table Table name the record comes from
519
+        * @param array $row Record to overlay. Must contain the columns uid, pid and $TCA[$table]['ctrl']['languageField']
520
+        * @param integer $sys_language_content Pointer to the sys_language uid to use for content.
521
+        * @param string $OLmode Overlay mode. If "hideNonTranslated" then records without translation will not be returned translated but unset (and return value is FALSE)
522
+        * @return mixed Returns the input record, possibly overlaid with a translation. But if $OLmode is "hideNonTranslated" then it will return FALSE if no translation is found.
523
+        */
524
+       public function getRecordOverlayWithoutFallback($table, $row, $sys_language_content, $OLmode) {
525
+
526
+// gridds added (end)
527
 		if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_page.php']['getRecordOverlay'])) {
528
 			foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_page.php']['getRecordOverlay'] as $classRef) {
529
 				$hookObject = GeneralUtility::getUserObj($classRef);
530
diff --git a/typo3/sysext/frontend/Tests/Unit/ContentObject/Menu/AbstractMenuContentObjectTest.php b/typo3/sysext/frontend/Tests/Unit/ContentObject/Menu/AbstractMenuContentObjectTest.php
531
index b97d23e..1fb8e5a 100644
532
--- a/typo3/sysext/frontend/Tests/Unit/ContentObject/Menu/AbstractMenuContentObjectTest.php
533
+++ b/typo3/sysext/frontend/Tests/Unit/ContentObject/Menu/AbstractMenuContentObjectTest.php
534
@@ -92,7 +92,10 @@ class AbstractMenuContentObjectTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
535
 		$this->fixture->sys_page->expects($this->once())->method('getPage')->will($this->returnValue(array('_PAGES_OVERLAY_LANGUAGE' => 1)));
536
 		$this->fixture->parent_cObj->expects($this->once())->method('exec_getQuery')->will($this->returnValue(1));
537
 		$GLOBALS['TYPO3_DB']->expects($this->exactly(2))->method('sql_fetch_assoc')->will($this->onConsecutiveCalls($this->returnValue(array('uid' => 0, 'header' => 'NOT_OVERLAID')), $this->returnValue(FALSE)));
538
-		$this->fixture->sys_page->expects($this->once())->method('getRecordOverlay')->will($this->returnValue(array('uid' => 0, 'header' => 'OVERLAID')));
539
+		// gridds removed (one line)
540
+		// $this->fixture->sys_page->expects($this->once())->method('getRecordOverlay')->will($this->returnValue(array('uid' => 0, 'header' => 'OVERLAID')));
541
+		// gridds added (one line)
542
+		$this->fixture->sys_page->expects($this->once())->method('getRecordOverlayWithFallback')->will($this->returnValue(array('uid' => 0, 'header' => 'OVERLAID')));
543
 		$result = $this->fixture->_call('sectionIndex', 'field');
544
 		$this->assertEquals($result[0]['title'], 'OVERLAID');
545
 	}
546
diff --git a/typo3/sysext/t3editor/res/tsref/tsref.xml b/typo3/sysext/t3editor/res/tsref/tsref.xml
547
index d15d240..0c880ea 100644
548
--- a/typo3/sysext/t3editor/res/tsref/tsref.xml
549
+++ b/typo3/sysext/t3editor/res/tsref/tsref.xml
550
@@ -1002,6 +1002,18 @@ ignore - The system will stay with the selected language even if the page is not
551
 			<default><![CDATA[
552
 ]]></default>
553
 		</property>
554
+
555
+<!-- gridds added (start) -->
556
+
557
+<property name="languageFallbackChain" type="string">
558
+                       <description><![CDATA[Ordered Comma-separated list of language ids for the language fallback.]]></description>
559
+                       <default><![CDATA[
560
+]]></default>
561
+</property>
562
+
563
+<!-- gridds added (end) -->
564
+
565
+
566
 		<property name="sys_language_overlay" type="string">
567
 			<description><![CDATA[boolean / keyword
568
 			If set, records from certain tables selected by the CONTENT cObject using the "languageField" setting will select the default language (0) instead of any language set by sys_language_uid / sys_language_mode. In addition the system will look for a translation of the selected record and overlay configured fields.