lka20537
(Lucas Kalauch)
1
Hello,
I have a question regarding fusion:
I register a variable in context with:
@context.abc = ${this.var}
and use it to find a node:
testimage = Neos.Neos:ImageUri {
asset = ${q(node).find(abc).property(‘image’)}
maximumWidth = 2560
maximumHeight = 1280
@if.image = ${q(node).find(abc).property(‘image’)}
}
With ${this.var} i get a node identifier from a php class.
If try this snippet I get an error:
“Call to a member function getContext() on null”
What am I doing wrong?
Best,
Lucas
christianm
(Christian Müller)
2
You didn’t show how this.var
is generated. I guess there is your problem.
lka20537
(Lucas Kalauch)
3
Thank you for your reply!
The php function is:
/**
*
* @return string
*/
public function getVar()
{
$entrytNode = $this->findMenuStartingPoint();
$this->var= “#”.$entryNode->getIdentifier();
return $this->var;
}
Note: var is just the placeholder for the variable name
I get the nodes Identifier as a string like this “#b1re54f-4f54f5e-frefred”
christianm
(Christian Müller)
4
And $this->findMenuStartingPoint()
?
Generally how do you use that PHP function? I think somewhere in that we will find the actual problem.
lka20537
(Lucas Kalauch)
5
I extend the \Neos\Neos\Fusion\MenuImplementation class and I think $this-> refers the current node.
christianm
(Christian Müller)
6
I guess that may explain it. Be aware that @context is set BEFORE the fusion object is actually executed, I guess that is the problem here.
lka20537
(Lucas Kalauch)
7
Thank you this helped me a lot!