From 0b015eb31e71dfce776c3be45a490025c51b8438 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anke=20H=C3=A4slich?= Date: Mon, 6 Nov 2023 08:14:36 +0100 Subject: [PATCH] BUGFIX: Neos.NodeTypes.ContentReferences:ContentReferences prototype is now a ContentComponent The NodeType fusion renderer is now pure fusion, the behavior including attributes is kept. Relates: #4537 Relates: #4705 --- .../Resources/Private/Fusion/Root.fusion | 26 ++++++++++++++++--- .../NodeTypes/ContentReferences.html | 15 ----------- 2 files changed, 23 insertions(+), 18 deletions(-) delete mode 100644 Neos.NodeTypes.ContentReferences/Resources/Private/Templates/NodeTypes/ContentReferences.html diff --git a/Neos.NodeTypes.ContentReferences/Resources/Private/Fusion/Root.fusion b/Neos.NodeTypes.ContentReferences/Resources/Private/Fusion/Root.fusion index f26474a0dae..3f127dfea38 100644 --- a/Neos.NodeTypes.ContentReferences/Resources/Private/Fusion/Root.fusion +++ b/Neos.NodeTypes.ContentReferences/Resources/Private/Fusion/Root.fusion @@ -1,6 +1,5 @@ # "Insert content references" Fusion Object -prototype(Neos.NodeTypes.ContentReferences:ContentReferences) < prototype(Neos.Neos:Content) { - templatePath = 'resource://Neos.NodeTypes.ContentReferences/Private/Templates/NodeTypes/ContentReferences.html' +prototype(Neos.NodeTypes.ContentReferences:ContentReferences) < prototype(Neos.Neos:ContentComponent) { @context.referenceNodesArray = ${q(node).property('references')} referenceNodes = Neos.Fusion:Loop { items = ${referenceNodesArray} @@ -16,7 +15,28 @@ prototype(Neos.NodeTypes.ContentReferences:ContentReferences) < prototype(Neos.N renderer.editable.condition = false } } - hasReferences = ${!!referenceNodesArray} + + attributes = Neos.Fusion:DataStructure + attributes.class = '' + # The following is used to automatically append a class attribute that reflects the underlying node type of a Fusion object, + # for example "neos-nodetypes-form", "neos-nodetypes-headline", "neos-nodetypes-html", "neos-nodetypes-image", "neos-nodetypes-menu" and "neos-nodetypes-text" + # You can disable the following line with: + # prototype(Neos.NodeTypes.ContentReferences:ContentReferences) { + # attributes.class.@process.nodeType > + # } + # in your site's Fusion if you don't need that behavior. + attributes.class.@process.nodeType = ${Array.push(value, String.toLowerCase(String.pregReplace(node.nodeTypeName.value, '/[[:^alnum:]]/', '-')))} + + renderer = afx` +
+

+ {Translation.id('content.noReferencesSelected').package('Neos.NodeTypes.ContentReferences').source('NodeTypes/ContentReferences')} +

+ {props.referenceNodes} +
+ + ` + @cache { mode = 'cached' entryIdentifier { diff --git a/Neos.NodeTypes.ContentReferences/Resources/Private/Templates/NodeTypes/ContentReferences.html b/Neos.NodeTypes.ContentReferences/Resources/Private/Templates/NodeTypes/ContentReferences.html deleted file mode 100644 index 68f589081f7..00000000000 --- a/Neos.NodeTypes.ContentReferences/Resources/Private/Templates/NodeTypes/ContentReferences.html +++ /dev/null @@ -1,15 +0,0 @@ -{namespace neos=Neos\Neos\ViewHelpers} - - - f:format.raw()}> - {referenceNodes -> f:format.raw()} - - - - - f:format.raw()}> -

{f:translate(id: 'content.noReferencesSelected', package: 'Neos.NodeTypes.ContentReferences', source: 'NodeTypes/ContentReferences')}

- -
-
-