File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed
src/aleksip/DataTransformPlugin/Twig Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -37,15 +37,20 @@ public function setData($data)
37
37
$ this ->setData ($ v );
38
38
}
39
39
$ this ->data .= ') ' ;
40
- } elseif ($ data instanceof Attribute ) {
41
- $ this ->data .= 'new \Drupal\Core\Template\Attribute ( ' ;
42
- $ this ->setData ( $ data-> toArray ( ));
40
+ } elseif (is_object ( $ data) ) {
41
+ $ this ->data .= 'unserialize ( ' ;
42
+ $ this ->data .= $ this -> string ( serialize ( $ data ));
43
43
$ this ->data .= ') ' ;
44
44
} else {
45
- $ this ->data .= sprintf ( ' "%s" ' , addcslashes ( $ data, "\0\t\"\$\\" ) );
45
+ $ this ->data .= $ this -> string ( $ data );
46
46
}
47
47
}
48
48
49
+ protected function string ($ value )
50
+ {
51
+ return sprintf ('"%s" ' , addcslashes ($ value , "\0\t\"\$\\" ));
52
+ }
53
+
49
54
protected function addTemplateArguments (\Twig_Compiler $ compiler )
50
55
{
51
56
$ variables = $ this ->hasNode ('variables ' )
You can’t perform that action at this time.
0 commit comments