The extension variable in Test2 is not available in the processor - why?
In my understanding, the tag prototype in test2 is evaluated to string, thats why I can extend it with the “+” operator. But it also seems, that it somehow opens a new context and a @context is needed to access the extension variable.
Thanks @bwaidelich for the clarification, but I really think its confusing.
You exactly need to know of which kind a value is, which you try to extend. Sometimes it works sometimes not (without any error feedback)
I thought it is a good idea to be saving with @context variables to keep the context as slim as possible - I hope the people don’t use context variables just “to be save”.
I don’t think that you keep it any slimmer by using this really
Also, the @context is used for a lot of stuff already (e.g. to store the current node).
My problem with it is that it’s currently not really possible to separate private, public and “augmented” API so naming clashes are likely – but that’s the same with this.
Having played around with context variables in the last week a lot, your examples seem completely logical for me:
Example
It works, because this.extension is inside the scope (inside Neos.Fusion:Value object).
Example
It does not work, because this.extension is not available inside the scope (inside Neos.Fusion:Tag object).
Example
It works, because you made a context variable for the extension and don’t try to use this.extension, but the context variable extension, which is available in the inner scope (inside Neos.Fusion:Tag).
… which clearly shows you are out of the scope for extension. Bear in mind: the two “value” objects/variables are not the same, which is confusing, but totally up to you Inside a processor, the original value is always in the value variable and has nothing to to with your outer “value” object of type Neos.Fusion:Tag.