@@ -50,31 +50,28 @@ class FusionService
50
50
/**
51
51
* Render the given string of AFX and returns it
52
52
*
53
- * @param TraversableNodeInterface[] $contextNodes
53
+ * @param array $contextProperties
54
54
* @param string $html
55
55
* @param string|null $props
56
56
* @return string
57
57
* @throws ContentBoxRenderingException|AfxParserException
58
58
*/
59
- public function render (array $ contextNodes , string $ html , ?string $ props = null ): string
59
+ public function render (array $ contextProperties , string $ html , ?string $ props = null ): string
60
60
{
61
61
$ props = isset ($ props ) ? Yaml::parse ($ props ) : [];
62
62
$ controllerContext = $ this ->createDummyControllerContext ();
63
63
64
64
try {
65
65
$ fusion = AfxService::convertAfxToFusion ($ html );
66
- $ parsedFusion = $ this ->parseFusionSourceCode ('html = ' . $ fusion , $ contextNodes ['site ' ] ?? null );
66
+ $ parsedFusion = $ this ->parseFusionSourceCode ('html = ' . $ fusion , $ contextProperties ['site ' ] ?? null );
67
67
68
68
$ fusionRuntime = $ this ->fusionRuntimeFactory ->createFromConfiguration ($ parsedFusion , $ controllerContext );
69
69
$ fusionRuntime ->pushContext ('props ' , $ props );
70
- if (isset ($ contextNodes ['node ' ])) {
71
- $ fusionRuntime ->pushContext ('node ' , $ contextNodes ['node ' ]);
72
- }
73
- if (isset ($ contextNodes ['documentNode ' ])) {
74
- $ fusionRuntime ->pushContext ('documentNode ' , $ contextNodes ['documentNode ' ]);
75
- }
76
- if (isset ($ contextNodes ['site ' ])) {
77
- $ fusionRuntime ->pushContext ('site ' , $ contextNodes ['site ' ]);
70
+
71
+ foreach ($ contextProperties as $ key => $ value ) {
72
+ if ($ value ) {
73
+ $ fusionRuntime ->pushContext ($ key , $ value );
74
+ }
78
75
}
79
76
$ fusionRuntime ->setEnableContentCache (false );
80
77
return $ fusionRuntime ->render ('html ' );
0 commit comments