[Neos] Using NodeViewHelper Within a Plugin

Christian Müller christian.mueller at typo3.org
Wed Jul 10 19:51:18 CEST 2013

Hi Jeff,

at least I can say that this was to be expected with the context cleanup.

To clarify things a bit lets see what has changed: Before the context 
was stored in the NodeRepository singleton and so accessible virtually 
everywhere, but the drawback was that the context (being not a 
singleton) behaved like a singleton because changing the context in the 
NodeRepository would lead to unexpected results. The ViewHelper simply 
used the context in the NodeRepository.
Now the ViewHelper expects to either get a Node object (with a context) 
or tries to find a context from its environment "fluidTemplateTsObject" 
which is set in all Fluid templates invoked from TypoScript. So I 
suspect you use the Viewhelper with a string path and so trigger the 
exception. You have several ways of dealing with that.

Probably the easiest would be to use the current node or document node 
that you now get in your plugin as internalArguments "node" and 
"documentNode" and go from there. They have the correct context and you 
can use getNode() on them to fetch the node you want and use that in the 
Another option is that your plugin controller again uses a typoscript 
view and you give the internalArgument to the typoscript view to go 
from. That way a fluid template inside will again have the 
"fluidTemplateTsObject" set.
A third option which I would not recommend would be to use the 
NodeConverter to convert the path you have to a Node object, but then 
you probably won't have the same context as outside your plugin.

Hope that all makes sense and works for you, otherwise come back to me 
and I will try to provide you with some code examples for it.


Jeff Segars wrote:
> I'm working on upgrading a project to Neos Alpha 4 and its mostly gone
> smoothly but I have run into one issue which I believe is related to the
> recent context cleanup.
> Within my plugin, I use neos:link.node to link out to specific pages
> within the site. Prior to Alpha 4, this worked properly but now I get
> the following exception.
> Uncaught exception #1224479370 in line 89 of
> /.../TYPO3_Neos_ViewHelpers_Uri_NodeViewHelper.php: Tried to get a
> variable "fluidTemplateTsObject" which is not stored in the context!
> When using the same view helper outside of a plugin, everything works as
> expected.
> Is this something that should still work or is using the node view
> helper within a plugin a bad idea?
> Thanks!
> Jeff

More information about the Neos mailing list