@@ -35,31 +35,28 @@ class FusionService extends NeosFusionService
35
35
/**
36
36
* Render the given string of AFX and returns it
37
37
*
38
- * @param [NodeInterface] $contextNodes
38
+ * @param array $contextProperties
39
39
* @param string $html
40
40
* @param string|null $props
41
41
* @return string
42
42
* @throws ContentBoxRenderingException|AfxParserException
43
43
*/
44
- public function render (array $ contextNodes , string $ html , ?string $ props = null ): string
44
+ public function render (array $ contextProperties , string $ html , ?string $ props = null ): string
45
45
{
46
46
$ props = isset ($ props ) ? Yaml::parse ($ props ) : [];
47
47
$ controllerContext = $ this ->createDummyControllerContext ();
48
48
49
49
try {
50
50
$ fusion = AfxService::convertAfxToFusion ($ html );
51
- $ parsedFusion = $ this ->getMergedFusionObjectTree ('html = ' . $ fusion , $ contextNodes ['site ' ] ?? null );
51
+ $ parsedFusion = $ this ->getMergedFusionObjectTree ('html = ' . $ fusion , $ contextProperties ['site ' ] ?? null );
52
52
53
53
$ fusionRuntime = $ this ->fusionRuntimeFactory ->create ($ parsedFusion , $ controllerContext );
54
54
$ fusionRuntime ->pushContext ('props ' , $ props );
55
- if (isset ($ contextNodes ['node ' ])) {
56
- $ fusionRuntime ->pushContext ('node ' , $ contextNodes ['node ' ]);
57
- }
58
- if (isset ($ contextNodes ['documentNode ' ])) {
59
- $ fusionRuntime ->pushContext ('documentNode ' , $ contextNodes ['documentNode ' ]);
60
- }
61
- if (isset ($ contextNodes ['site ' ])) {
62
- $ fusionRuntime ->pushContext ('site ' , $ contextNodes ['site ' ]);
55
+
56
+ foreach ($ contextProperties as $ key => $ value ) {
57
+ if ($ value ) {
58
+ $ fusionRuntime ->pushContext ($ key , $ value );
59
+ }
63
60
}
64
61
$ fusionRuntime ->setEnableContentCache (false );
65
62
0 commit comments