Skip to content

Commit 5302daa

Browse files
authored
Merge pull request #143 from lilt/4.x-fix-nested-field
Fix translation of nested link field
2 parents 3331cce + f9bd0b5 commit 5302daa

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
44

55
The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/).
66

7+
## 4.4.5 - 2024-02-09
8+
### Fixed
9+
- Translation of nested link field
10+
711
## 4.4.4 - 2024-01-31
812
### Changed
913
- Change translations batch size

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "lilt/craft-lilt-plugin",
33
"description": "The Lilt plugin makes it easy for you to send content to Lilt for translation right from within Craft CMS.",
44
"type": "craft-plugin",
5-
"version": "4.4.4",
5+
"version": "4.4.5",
66
"keywords": [
77
"craft",
88
"cms",

src/services/appliers/field/LenzLinkFieldContentApplier.php

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,20 @@ public function apply(ApplyContentCommand $command): ApplyContentResult
3232
$fieldValue = $command->getElement()->getFieldValue(
3333
$field->handle
3434
);
35+
3536
$fieldValue->customText = $content[$fieldKey];
3637

37-
$command->getElement()->setFieldValue($field->handle, $fieldValue);
38+
$serialized = $field->serializeValue($fieldValue, $command->getElement());
39+
$command->getElement()->setFieldValues([$field->handle => $serialized]);
40+
41+
$this->forceSave($command);
3842

39-
return ApplyContentResult::applied();
43+
return ApplyContentResult::applied(
44+
[],
45+
$command->getElement()->getFieldValue(
46+
$command->getField()->handle
47+
)
48+
);
4049
}
4150

4251
public function support(ApplyContentCommand $command): bool

0 commit comments

Comments
 (0)