Good morning,
I’d like to get a variable of a function of a custom fusion object class in fusion, so that I can use this variable in a fusion template.
For example my custom fusion object class looks like this:
namespace Vendor\Site\Fusion;
use Neos\Flow\Annotations as Flow;
use Neos\Fusion\FusionObjects\AbstractFusionObject
class GravatarImplementation extends AbstractFusionObject {
public function evaluate() {
$var = 'example';
return $var;
}
}
And my fusion-prototypes like this:
prototype(Vendor.Site:Test) < prototype(Vendor.Site:Gravatar) {
templatePath = 'resource://Vendor.Site/Private/Templates/FusionObjects/Test.html'
test = Vendor.Site:Gravatar
}
prototype(Vendor.Site:Gravatar) {
@class = 'Vendor\\Site\\Fusion\\GravatarImplementation'
}
My fluid template “Test.html” like that:
{namespace neos=Neos\Neos\ViewHelpers}
{namespace media=Neos\Media\ViewHelpers}
<div>{test}</div>
As expected, I can use {test}
in fluid, so at the end ‘example’ is rendered - so far, so good.
My question is: How can I access the variable $var
of the class GravatarImplementation in the prototype for a later use in fluid?
Something like var = Itoop.AlstaettertcDe:RawPosts::$var
in the prototype, so that I can use {var}
in fluid.
For a better understanding of my question: I’m looking for the opposite of $this->tsValue('__ts_value_key__');
, so I don’t want to access values from Fusion in the class but the other way round.