Skip to content

Commit a5e9047

Browse files
author
René Hrdina
committed
feat: properly support translated info collection fields
1 parent 54d9726 commit a5e9047

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

bundle/Ibexa/ContentForms/InformationCollectionMapper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ final class InformationCollectionMapper
2121
*/
2222
public function mapToFormData(Content $content, Location $location, ContentType $contentType): InformationCollectionStruct
2323
{
24-
$fields = $content->getFieldsByLanguage($content->contentInfo->mainLanguageCode);
24+
$fields = $content->getFieldsByLanguage();
2525

2626
$informationCollectionFields = [];
2727

lib/Handler.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,10 @@ public function getForm(Content $content, Location $location): FormInterface
3939

4040
$data = $informationCollectionMapper->mapToFormData($content, $location, $contentType);
4141

42+
$initialLanguageCode = $content->getVersionInfo()->getInitialLanguage()->languageCode;
43+
4244
return $this->formFactory->create(InformationCollectionType::class, $data, [
43-
'languageCode' => $content->contentInfo->mainLanguageCode,
45+
'languageCode' => $initialLanguageCode ?? $content->contentInfo->mainLanguageCode,
4446
'mainLanguageCode' => $content->contentInfo->mainLanguageCode,
4547
]);
4648
}

0 commit comments

Comments
 (0)