Last active
January 22, 2018 10:32
-
-
Save mficzel/dbd19a4584be71c05670da0e5d680762 to your computer and use it in GitHub Desktop.
Fusion Node Mapping
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# ATTENTION UNTESTED PSEUDO-CODE TO SHOW THE PRINCIPLE IDEA | |
# | |
# THIS DOES NOT WORK YET | |
# | |
prototype(Neos.Fusion:RawCollection) { | |
// store __node reference in the rendered result | |
// if item is a node and the value is an array | |
[email protected] { | |
@if.itemIsNode = ${q(item).is('[instanceof Neos.Neos:Node]')} | |
@if.valueIsArray = ${Type.isArray(value)} | |
expression = ${Array.concat(value, [__node: item])} | |
} | |
} | |
prototype(Neos.Fusion:Collection) { | |
// apply content element wrapping to all items with __node meta property | |
[email protected] { | |
@if.itemIsArray = ${Type.isArray(this[itemName])} | |
@if.itemHasNode = ${item.__node && q(this[itemName].__node).is('[instanceof Neos.Neos:Node]')} | |
expression = Neos.Neos:ContentElementWrapping { | |
node = ${this[itemName].__node} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment