Skip to content

Commit

Permalink
[BUGFIX] Fix localization record merging logic.
Browse files Browse the repository at this point in the history
Update the logic to correctly merge localized records by checking the presence of a '_LOCALIZED_UID' in the content object's data. This change ensures that records are only merged when a valid localized version is available.

I extracted $this->recoredService->getSingle(...) from the array_merge function because it had never merged the localised record on my system here.
Therefore, getSingle is saved in an extra variable and then merged if it exists.
  • Loading branch information
monosize committed Dec 4, 2024
1 parent a167840 commit 31e6f23
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions Classes/Controller/AbstractFluxController.php
Original file line number Diff line number Diff line change
Expand Up @@ -583,15 +583,18 @@ public function getRecord(): array
);
}

if ($record['_LOCALIZED_UID'] ?? false) {
$record = array_merge(
$record,
$this->recordService->getSingle(
(string) $this->getFluxTableName(),
'*',
$record['_LOCALIZED_UID']
) ?? $record
if ($contentObject->data['_LOCALIZED_UID'] ?? false) {
$localized = $this->recordService->getSingle(
(string) $this->getFluxTableName(),
'*',
$contentObject->data['_LOCALIZED_UID']
);
if ($localized) {
$record = array_merge(
$record,
$localized
);
}
}
return $record;
}
Expand Down

0 comments on commit 31e6f23

Please sign in to comment.