File tree Expand file tree Collapse file tree 1 file changed +21
-7
lines changed Expand file tree Collapse file tree 1 file changed +21
-7
lines changed Original file line number Diff line number Diff line change 2
2
3
3
namespace Charcoal \Property ;
4
4
5
- use Charcoal \Embed \Mixin \EmbedRepositoryTrait ;
6
5
use RuntimeException ;
7
6
7
+ // From Pimple
8
+ use Pimple \Container ;
9
+
10
+ // From 'charcoal-translator'
11
+ use Charcoal \Translator \Translation ;
12
+
8
13
// From 'charcoal-property'
9
- use Charcoal \Embed \Service \EmbedRepository ;
10
14
use Charcoal \Property \UrlProperty ;
11
- use Pimple \Container ;
15
+
16
+ // From 'charcoal-contrib-embed'
17
+ use Charcoal \Embed \Mixin \EmbedRepositoryTrait ;
18
+ use Charcoal \Embed \Service \EmbedRepository ;
12
19
13
20
/**
14
21
* Class EmbedProperty
@@ -60,10 +67,17 @@ public function save($val)
60
67
{
61
68
$ val = parent ::save ($ val );
62
69
63
- $ this ->embedRepository ()->saveEmbedData (
64
- (string )$ this ->translator ()->translation ($ val ),
65
- $ this ->embedFormat ()
66
- );
70
+ if ($ val instanceof Translation) {
71
+ foreach ($ val ->data () as $ lang => $ value ) {
72
+ if (!empty ($ value )) {
73
+ $ this ->embedRepository ()->saveEmbedData ($ value , $ this ->embedFormat ());
74
+ }
75
+ }
76
+ } else {
77
+ if (!empty ($ val )) {
78
+ $ this ->embedRepository ()->saveEmbedData ($ val , $ this ->embedFormat ());
79
+ }
80
+ }
67
81
68
82
return $ val ;
69
83
}
You can’t perform that action at this time.
0 commit comments