Skip to content

Commit bbff05c

Browse files
[BUGFIX] Handle localization of RawRecords correctly (#415)
Fixes: #405 Fixes: #413 --------- Co-authored-by: Nikita Hovratov <[email protected]>
1 parent e25059d commit bbff05c

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

Classes/DataProcessing/ContentBlocksDataProcessor.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,17 @@ public function process(
5151
if ($data === []) {
5252
return $processedData;
5353
}
54+
if (array_key_exists('_computed', $data) === true) {
55+
// We have a raw-record as input and can get the necessary localization properties
56+
// from the _computed array to fetch the correct translation.
57+
// Basically do the reverse of RecordFactory::extractComputedProperties()
58+
// @see \TYPO3\CMS\Core\Domain\RecordFactory::extractComputedProperties()
59+
// @todo This must be fixed in Core so that Language Overlay API considers computed properties.
60+
$data['_ORIG_uid'] = $data['_computed']['versionedUid'] ?? null;
61+
$data['_LOCALIZED_UID'] = $data['_computed']['localizedUid'] ?? null;
62+
$data['_REQUESTED_OVERLAY_LANGUAGE'] = $data['_computed']['requestedOverlayLanguageId'] ?? null;
63+
$data['_TRANSLATION_SOURCE'] = $data['_computed']['translationSource'] ?? null;
64+
}
5465
$resolvedRecord = $this->recordFactory->createResolvedRecordFromDatabaseRow($table, $data);
5566
$processedData['data'] = $this->contentBlockDataDecorator->decorate($resolvedRecord);
5667
return $processedData;

0 commit comments

Comments
 (0)