我为我的项目下载了 Lelesys.Plugin.SlideShow 插件。这引入了两个 NodeType 原型:
prototype(Lelesys.Plugin.SlideShow:SlideShowContainer) < prototype(TYPO3.Neos:Content)
prototype(Lelesys.Plugin.SlideShow:SlideShowContainer) {
templatePath = 'resource://Lelesys.Plugin.SlideShow/Private/Templates/TypoScript/SlideShowContainer.html'
slideShowContainerCollection = ${q(node).children('slideShowContainer').children('[instanceof TYPO3.Neos.NodeTypes:Image]')}
slideShowContainerItemCollection = TYPO3.Neos:ContentCollection
slideShowContainerItemCollection {
nodePath = 'slideShowContainer'
}
properties = ${node.properties}
}
prototype(Lelesys.Plugin.SlideShow:SlideShowItem) < prototype(TYPO3.Neos.NodeTypes:Image)
prototype(Lelesys.Plugin.SlideShow:SlideShowItem) {
templatePath = 'resource://Lelesys.Plugin.SlideShow/Private/Templates/TypoScript/SlideShowItem.html'
slideShowContainerProperty = ${q(node).property('_parent.parent.properties')}
sliderImageTitle = ${q(node).property('sliderImageTitle')}
sliderImageDescription = ${q(node).property('sliderImageDescription')}
}
如您所见,它带有预定义的模板。我把它换成了我自己的。在 SlideShowContainer 的模板中,我大致有这种情况:
<f:if condition="{slideShowContainerCollection -> f:count()}>1">
<f:then>
<f:for each="{slideShowContainerCollection}" as="slideitem" iteration="slideitemIterator">
<media:image image="{slideitem.properties.image}" alt="test" />
这是我现在做的最好的事情,使用 TYPO3.Media ImageViewHelper 在 SlideShowItem 中渲染图像,它继承自 TYPO3.Neos.NodeTypes:Image。
正常的实现是这样的:
{slideShowContainerItemCollection -> f:format.raw()}
这基本上从 Neos 获取 ContentCollection 并使用 SlideShowItem 中的模板完全呈现它,就像它应该做的那样。
现在,由于 SlideShowItem 节点类型已经与模板相关联,我认为必须有一种直接的方式来使用简单的命令呈现 SlideShowItem 节点,自动考虑配置的模板。就像是:
<f:render node="{slideitem}">
这只是我的幻想,但是当 Neos 很容易自动生成整个节点集合的输出时,应该有一种方法来渲染单个节点。
我对节点系统和Fluid引擎的理解是相当新手的。最接近我想要的东西是什么?