@@ -26,7 +26,7 @@ class PageLayoutHeader
26
26
protected $ backendUser ;
27
27
28
28
/**
29
- * @var integer
29
+ * @var int
30
30
*/
31
31
protected $ pageUid ;
32
32
@@ -35,13 +35,41 @@ class PageLayoutHeader
35
35
*/
36
36
protected $ pageRecord ;
37
37
38
+ /**
39
+ * @var int
40
+ */
41
+ protected $ language ;
42
+
38
43
39
44
40
45
public function __construct ()
41
46
{
42
47
$ this ->backendUser = $ GLOBALS ['BE_USER ' ];
43
48
$ this ->pageUid = (int )GeneralUtility::_GET ('id ' );
44
49
$ this ->pageRecord = BackendUtility::getRecord ('pages ' , $ this ->pageUid );
50
+ $ this ->language = (int )BackendUtility::getModuleData (['language ' ], [], 'web_layout ' )['language ' ];
51
+
52
+ $ this ->updatePageRecordIfOverlay ();
53
+ }
54
+
55
+
56
+
57
+ /**
58
+ *
59
+ */
60
+ protected function updatePageRecordIfOverlay (): void
61
+ {
62
+ if ($ this ->language > 0 ) {
63
+ $ overlayRecords = BackendUtility::getRecordLocalization (
64
+ 'pages ' ,
65
+ $ this ->pageUid ,
66
+ $ this ->language
67
+ );
68
+
69
+ if (is_array ($ overlayRecords ) && array_key_exists (0 , $ overlayRecords ) && is_array ($ overlayRecords [0 ])) {
70
+ $ this ->pageRecord = $ overlayRecords [0 ];
71
+ }
72
+ }
45
73
}
46
74
47
75
@@ -60,7 +88,7 @@ public function render(): string
60
88
$ pageRenderer ->loadRequireJsModule ('TYPO3/CMS/Quickedit/Quickedit ' );
61
89
62
90
$ standaloneView = $ this ->initializeStandaloneView ();
63
- $ standaloneView ->assign ('pageId ' , $ this ->pageUid );
91
+ $ standaloneView ->assign ('pageId ' , $ this ->pageRecord [ ' uid ' ] );
64
92
$ standaloneView ->assign ('config ' , $ this ->getFieldConfigForPage ());
65
93
$ standaloneView ->assign ('isVisible ' , $ this ->isVisible ());
66
94
@@ -198,7 +226,8 @@ protected function prepareFieldsList(string $fields): string
198
226
$ fieldsArray = array_map ('trim ' , $ fieldsArray );
199
227
200
228
foreach ($ fieldsArray as $ index => $ field ) {
201
- if ($ this ->userHasAccessToField ($ field ) === false ) {
229
+ if ($ this ->userHasAccessToField ($ field ) === false
230
+ || $ this ->fieldIsAvailableForLanguage ($ field ) === false ) {
202
231
unset($ fieldsArray [$ index ]);
203
232
}
204
233
}
@@ -222,6 +251,24 @@ protected function userHasAccessToField(string $field): bool
222
251
223
252
224
253
254
+ /**
255
+ * @param string $field
256
+ * @return bool
257
+ */
258
+ protected function fieldIsAvailableForLanguage (string $ field ): bool
259
+ {
260
+ if ($ this ->language > 0 ) {
261
+ return $ field !== '' && (
262
+ !array_key_exists ('l10n_mode ' , $ GLOBALS ['TCA ' ]['pages ' ]['columns ' ][$ field ]) ||
263
+ $ GLOBALS ['TCA ' ]['pages ' ]['columns ' ][$ field ]['l10n_mode ' ] !== 'exclude '
264
+ );
265
+ }
266
+
267
+ return true ;
268
+ }
269
+
270
+
271
+
225
272
/**
226
273
* Checks set previewFields and get the corresponding field labels and values for display in backend.
227
274
*
@@ -284,8 +331,8 @@ protected function isVisible(): bool
284
331
285
332
if (array_key_exists ('quickedit ' , $ this ->backendUser ->uc ) &&
286
333
array_key_exists ('visible ' , $ this ->backendUser ->uc ['quickedit ' ]) &&
287
- array_key_exists ($ this ->pageUid , $ this ->backendUser ->uc ['quickedit ' ]['visible ' ])) {
288
- $ isVisible = (bool )$ this ->backendUser ->uc ['quickedit ' ]['visible ' ][$ this ->pageUid ];
334
+ array_key_exists ($ this ->pageRecord [ ' uid ' ] , $ this ->backendUser ->uc ['quickedit ' ]['visible ' ])) {
335
+ $ isVisible = (bool )$ this ->backendUser ->uc ['quickedit ' ]['visible ' ][$ this ->pageRecord [ ' uid ' ] ];
289
336
}
290
337
291
338
return $ isVisible ;
0 commit comments