Created
June 16, 2021 09:37
-
-
Save Sebobo/48fcc490e7655f66208aaf0259b43859 to your computer and use it in GitHub Desktop.
Optimized ContentReferences for NeosCMS
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
prototype(Neos.NodeTypes.ContentReferences:ContentReferences) > | |
prototype(Neos.NodeTypes.ContentReferences:ContentReferences) < prototype(Neos.Neos:ContentComponent) { | |
@context.referenceNodesArray = ${q(node).property('references')} | |
referenceNodes = Neos.Fusion:Collection { | |
collection = ${referenceNodesArray} | |
itemRenderer = Neos.Neos:ContentCase | |
itemName = 'node' | |
} | |
renderer = afx` | |
<div class="neos-nodetypes-contentreferences"> | |
{props.referenceNodes} | |
{!props.referenceNodes ? I18n.translate('content.noReferencesSelected', '', [], 'NodeTypes/ContentReferences', 'Neos.NodeTypes.ContentReferences') : ''} | |
</div> | |
` | |
@cache { | |
mode = 'cached' | |
entryIdentifier { | |
node = ${node} | |
} | |
entryTags { | |
1 = ${Neos.Caching.nodeTag(node)} | |
2 = ${Neos.Caching.nodeTag(referenceNodesArray)} | |
3 = ${Neos.Caching.descendantOfTag(referenceNodesArray)} | |
} | |
} | |
// Prevent additional cache blocks from nested references | |
prototype(Neos.NodeTypes.ContentReferences:ContentReferences) { | |
@cache.mode = 'embed' | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Related to issue neos/neos-development-collection#3355