Open mhsdesign opened 8 months ago
I am pretty sure there was a good reason for doing it this way. You shoulnd't if a processor anyway but rather use a control structure on the replacement ala value = ${value == 'abc' ? 123 : value}
. While I guess in this special case of processors it could make sense to have the value already I find in normal rendering cases you would want to first evaluate if before doing anything on the fusion object in question.
in my specific case i just wanted to quickly notate this:
# resource:// or http://
resourceUri = 'resource://Foo.Bar'
resourceUri.@process.convertResourceStreamWrapper = Neos.Fusion:ResourceUri {
@if.isResourceStreamWrapper = ${String.indexOf(value, 'resource://') == 0}
path = ${value}
}
in the end i build a full blown prototype:
prototype(Neos.Neos:Core.ImageSource) < prototype(Neos.Fusion:Component) {
path = ''
renderer = Neos.Fusion:Case {
resourcePath {
condition = ${String.indexOf(props.path, 'resource://') == 0}
renderer = Neos.Fusion:ResourceUri {
path = ${props.path}
}
}
default {
condition = true
renderer = ${props.path}
}
}
}
But i would be also fine with closing this as not planned, as my above prosed fusion config is not super easy to decipher i guess. So to quickly move forward let met now if i should close this or well keep it open until we find the time to discuss this.
@if
is evaluated before thevalue
is pushed into the context. It is to be discussed if this is intended behaviour or not:The logic lies in https://github.com/neos/neos-development-collection/blob/336a658ee5e6be98b3b034a4c04773b59fde513b/Neos.Fusion/Classes/Core/Runtime.php#L855. Locally i could fix it by moving the
pushContext
first.but changing this behaviour would "break" this: