@@ -29,7 +29,39 @@ public function translateObjectAction(Request $request)
2929 $ item = DataObject::getById ($ itemId );
3030
3131 foreach ($ data as $ key => $ value ) {
32- $ item ->set ($ key , $ value , $ localizedField );
32+ if (str_contains ($ key , 'structuredData# ' )) {
33+ list ($ prefix , $ fieldName , $ index , $ type , $ strField ) = explode ('. ' , $ key );
34+
35+ $ structuredField = $ item ->get ($ fieldName );
36+
37+ if ($ structuredField instanceof DataObject \Fieldcollection) {
38+ $ structuredField ->setObject ($ item );
39+ $ structuredField ->get ($ index )->set ($ strField , $ value , $ localizedField );
40+ }
41+
42+ if ($ structuredField instanceof DataObject \Objectbrick) {
43+ $ structuredField ->setObject ($ item );
44+ $ structuredField ->get ($ type )->set ($ strField , $ value , $ localizedField );
45+ }
46+
47+ if (is_array ($ structuredField ) && $ type === 'undefined ' ) {
48+ $ blockItem = $ structuredField [$ index ];
49+ $ localizedFields = $ blockItem ['localizedfields ' ]->getData ();
50+ $ localizedFields ->setLocalizedValue ($ strField , $ value , $ localizedField );
51+ }
52+
53+ } elseif (str_contains ($ key , 'classificationStore# ' )) {
54+ list ($ prefix , $ index , $ fieldName , $ strField ) = explode ('. ' , $ key );
55+
56+ $ structuredField = $ item ->get ($ fieldName );
57+
58+ if ($ structuredField instanceof DataObject \Classificationstore) {
59+ $ structuredField ->setObject ($ item );
60+ $ structuredField ->setLocalizedKeyValue ($ index , $ strField , $ value , $ localizedField );
61+ }
62+ } else {
63+ $ item ->set ($ key , $ value , $ localizedField );
64+ }
3365 }
3466
3567 $ item ->save ();
0 commit comments