Fusion API
Short overview
While most of the FlowQueries work as before, there are some adjustments that come with the new concepts that are introduced in Neos 9.
The most important changes are:
- Accessing properties of the node context via
node.context.
is no longer supported. And modifying the node context via flowQueryq(node).context()
is only partially supported. - Internal properties like
_hidden
and_name
are no longer in use. - Cache Entry Identifiers are now a dedicated object and not any value.
Upgrade instructions
Separating properties & references
With Neos 9 properties and references are now two different concepts. While the old logic still works, it is strongly encouraged to switch soon.
Old:${q(node).property('reference')}
New:${q(node).referenceNodes('reference')}
New feature: Back references
To get from a node to the referenced node, back references are now available with ${q(node).backReferenceNodes('referenceName')
.
Cache entry identifiers
The Cache Entry Identifier no longer supports just passing the node, it now requires a specialized entry identifier that is provided by the Caching Helper.
Old:
@cache {
mode = 'cached'
entryIdentifier {
documentNode = ${documentNode}
}
entryTags {
1 = ${Neos.Caching.nodeTypeTag('Neos.Neos:Document', documentNode)}
}
}
New:
@cache {
mode = 'cached'
entryIdentifier {
documentNode = ${Neos.Caching.entryIdentifierForNode(documentNode)}
}
entryTags {
1 = ${Neos.Caching.nodeTypeTag('Neos.Neos:Document', documentNode)}
}
}
Rendering modes
With Neos 9 the context property of nodes does not exist anymore in Fusion. The rendering mode is now moved to a separate variable that is independent of the node context.
Old: node.context.inBackend
node.context.currentRenderingMode.edit
!node.context.live
New: renderingMode.isEdit
New rendering mode: preview
The rendering mode does not only provide isEdit, but also differentiates the preview Mode, which can be called with renderingMode.isPreview
.
Dimensions
With Neos 9 there is a new configuration for dimensions, which also changes the way dimensions are used in Fusion. Also, since context is no longer available, a new helper was introduced to help out with dimension handling.
Old:$languages = ${Configuration.setting('Neos.ContentRepository.contentDimensions.language.presets')}
New:$languages = ${Configuration.setting('Neos.ContentRepositoryRegistry.contentRepositories.default.contentDimensions.language')}
Old:site.context.dimensions.language
New:Neos.Dimension.currentValue(node, 'language')
New feature: Dimension Helper
The new Dimension Helper can do much more, like getting all dimensions with Neos.Dimension.all(node)
or getting the values for one dimension with Neos.Dimension.allDimensionValues(node, 'language')
.
Visibility of Nodes
The visibility in Neos 9 has been changed to use Subtree Tags, thus deprecating all of the old internal properties for hiding Nodes.
Old:${q(node).property('_hidden')}
New:Neos.Node.isDisabled(node)
Old:q(node).property('_hiddenInIndex')
node.hiddenInIndex
New:q(node).property('hiddenInMenu')
Old:node.hiddenAfterDateTime
q(node).property('_hiddenAfterDateTime')
New:q(node).property('disableAfterDateTime')
Old:node.hiddenBeforeDateTime
q(node).property('_hiddenBeforeDateTime')
New:q(node).property('enableAfterDateTime')
Node internal properties
All old internal properties are no longer available and have been replaced by Node variables or have been moved to helpers.
Old:node.identifier
${q(node).property('_identifier') )}
New:node.aggregateId
Old:${q(node).property('_name')}
New:node.name
Old:node.nodeType.name
q(node).property('_nodeType.name')
New:node.nodeTypeName
Old:node.nodeType
q(node).property('_nodeType')
New:Neos.Node.nodeType(node)
Old:node.contextPath
q(node).property('_contextPath')
New:Neos.Node.serializedNodeAddress(node)
Old:node.autoCreated
q(node).property('_autoCreated')
New:node.classification.tethered
Old:node.depth
q(node).property('_depth')
New:Neos.Node.depth(node)
Old:node.label
q(node).property('_label')
New:Neos.Node.label(node)
Old:node.path
q(node).property('_path')
New:Neos.Node.path(node)
Old:node.parent
New:q(node).parent().get(0)
Getting the site
The currentSite in the context has been removed in favor of a new Site Helper.
Old:node.context.currentSite
New:Neos.Site.findBySiteNode(site)
Deprecations
Neos.Neos:PrimaryContent
is deprecated and has to be replaced with Neos.Neos:ContentCollection
.
Removals
The following Fusion prototypes were deprecated for a long time and are now finally removed.
Neos.Fusion:Array
is removed in favour ofNeos.Fusion:Join
Neos.Fusion:RawArray
is removed in favour ofNeos.Fusion:DataStructure
Neos.Fusion:Attributes
is removed. In most casesNeos.Fusion:DataStructure
can be used instead orNeos.Array.toHtmlAttributesString(value)
Neos.Fusion:Collection
is removed in favour ofNeos.Fusion:Loop
Neos.Fusion:RawCollection
is removed in favor ofNeos.Fusion:Map