Last active
February 5, 2018 10:48
-
-
Save mficzel/615ac91566ef024d3be87c0f8ec07ee7 to your computer and use it in GitHub Desktop.
Atomic.Fusion Collection Mapping :: Discussion of options
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
// Given the Neos.Fusion:Collection will iterate over the items that are given as array. | |
// If a ContentCollection is rendered and the nodes shall be edited inline the information | |
// wich node is rendererd has to be transferred to the collection whild keeping then interface | |
// of the component simple and serializable. | |
// | |
// This document discusses some of the possible syntax options. | |
// | |
// Automagic RawCollection | |
// | |
// + no configuration needed | |
// - will result in many unneded wraps especially for menus etc. | |
// | |
// This is the first working status quo from `PackageFactory.AtomicFusion.Mapping` | |
// | |
prototype(Vendor.Site:NodeList) < prototype(Neos.Neos:ContentComponent) { | |
renderer = Vendor.Site:Component.List { | |
items = Neos.Fusion:RawCollection { | |
collection = ${q(node).children().get()} | |
itemName = 'node' | |
itemRenderer = Neos.Fusion:RawArray { | |
title = Neos.Neos:Editable { | |
property = 'title' | |
block = 'false' | |
} | |
description = Neos.Neos:Editable { | |
property = 'description' | |
block = 'false' | |
} | |
} | |
} | |
} | |
} | |
// | |
// explicit magic array key `__node` | |
// | |
// + simple | |
// - you have to know the __node key | |
// - that it changes the behavior of the collection | |
// | |
prototype(Vendor.Site:NodeList) < prototype(Neos.Neos:ContentComponent) { | |
renderer = Vendor.Site:Component.List { | |
items = Neos.Fusion:RawCollection { | |
itemRenderer = Neos.Fusion:RawArray { | |
// ... as above ... | |
__node = ${node} | |
} | |
} | |
} | |
} | |
// | |
// explicit node reference storing via processor | |
// | |
// + also simple and explicit | |
// + with a good name altering the behavior of collections may be expected | |
// | |
prototype(Vendor.Site:NodeList) < prototype(Neos.Neos:ContentComponent) { | |
renderer = Vendor.Site:Component.List { | |
items = Neos.Fusion:RawCollection { | |
itemRenderer = Neos.Fusion:RawArray { | |
// ... as above ... | |
@process.storeNodeReference = PackageFactory.AtomicFusion.Mapping:NodeMapping { | |
node = ${node} | |
} | |
} | |
} | |
} | |
} | |
// | |
// explicit node reference storing via special mapping-prototyoe instead of Neos.Fusion:RawArray | |
// | |
// + simple and explicit | |
// + with a good name altering the behavior of collections may be expected | |
// - may make people expect things to happen if oused outside of collection | |
// | |
prototype(Vendor.Site:NodeList) < prototype(Neos.Neos:ContentComponent) { | |
renderer = Vendor.Site:Component.List { | |
items = Neos.Fusion:RawCollection { | |
itemRenderer = PackageFactory.AtomicFusion.Mapping:Node { | |
// ... as abode ... | |
node = ${node} | |
} | |
} | |
} | |
} | |
// | |
// explicit map to a RawArrayWithMetaData | |
// | |
// + simple and explicit | |
// + with a good name altering the behavior of collections may be expected | |
// - may make people expect things to happen if oused outside of collection | |
// | |
prototype(Vendor.Site:NodeList) < prototype(Neos.Neos:ContentComponent) { | |
renderer = Vendor.Site:Component.List { | |
items = Neos.Fusion:RawCollection { | |
itemRenderer = PackageFactory.AtomicFusion.Mapping:RawArrayWithMetaData { | |
// ... as above ... | |
@meta.node = ${node} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment