From 31e6f23839c4f5d152c6ce99c9a7c72bf217f038 Mon Sep 17 00:00:00 2001 From: Frank Rakow Date: Wed, 4 Dec 2024 16:58:21 +0100 Subject: [PATCH] [BUGFIX] Fix localization record merging logic. 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. --- Classes/Controller/AbstractFluxController.php | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/Classes/Controller/AbstractFluxController.php b/Classes/Controller/AbstractFluxController.php index c9d053cfb..9464ac728 100644 --- a/Classes/Controller/AbstractFluxController.php +++ b/Classes/Controller/AbstractFluxController.php @@ -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; }