File tree Expand file tree Collapse file tree 2 files changed +12
-14
lines changed
src/Entities/Items/Draft/Pages Expand file tree Collapse file tree 2 files changed +12
-14
lines changed Original file line number Diff line number Diff line change @@ -32,18 +32,18 @@ public function mount($record): void
3232 public function mutateFormDataBeforeFill (array $ data ): array
3333 {
3434 $ record = $ this ->getRecord ();
35-
35+ $ values = $ data ;
36+
3637 if (! method_exists ($ record , 'getTranslation ' ) || ! property_exists ($ record , 'translatedAttributes ' )) {
37- return $ data ;
38+ return $ values ;
3839 }
39-
40+
4041 $ translatable = $ record ->translatedAttributes ;
41- $ values = [];
4242 foreach ($ translatable as $ attr ) {
4343 $ translation = $ record ->getTranslation ($ this ->lang , false );
4444 $ values [$ attr ] = $ translation ? $ translation ->$ attr : $ record ->$ attr ;
4545 }
46-
46+
4747 return $ values ;
4848 }
4949
Original file line number Diff line number Diff line change @@ -26,16 +26,14 @@ public function mount($record): void
2626 public function mutateFormDataBeforeFill (array $ data ): array
2727 {
2828 $ record = $ this ->getRecord ();
29+ $ values = $ data ;
2930
30- if (! method_exists ($ record , 'getTranslation ' ) || ! property_exists ($ record , 'translatedAttributes ' )) {
31- return $ data ;
32- }
33-
34- $ translatable = $ record ->translatedAttributes ;
35- $ values = [];
36- foreach ($ translatable as $ attr ) {
37- $ translation = $ record ->getTranslation ($ this ->lang , false );
38- $ values [$ attr ] = $ translation ? $ translation ->$ attr : $ record ->$ attr ;
31+ if (method_exists ($ record , 'getTranslation ' ) && property_exists ($ record , 'translatedAttributes ' )) {
32+ $ translatable = $ record ->translatedAttributes ;
33+ foreach ($ translatable as $ attr ) {
34+ $ translation = $ record ->getTranslation ($ this ->lang , false );
35+ $ values [$ attr ] = $ translation ? $ translation ->$ attr : $ record ->$ attr ;
36+ }
3937 }
4038
4139 return $ values ;
You can’t perform that action at this time.
0 commit comments