是否可以在嵌套CE中获取父CE类型/名称?我有一个带有两列的Custom Flux Grid CE,在列中你可以放置另一个CE。现在我想检测孩子是否在网格中,如果是,那么这样做。
无论用于存储父子关系的技术如何,您都可以使用FLUIDTEMPLATE参数dataProcessing
。
通过像这样的DatabaseQueryProcessor创建变量children
或parent
tt_content.mycontent.20 = FLUIDTEMPLATE
tt_content.mycontent.20 {
file = EXT:site_default/Resources/Private/Templates/ContentObjects/MyContent.html
dataProcessing.10 = TYPO3\CMS\Frontend\DataProcessing\DatabaseQueryProcessor
dataProcessing.10 {
# regular if syntax
if.isTrue.field = records
# the table name from which the data is fetched from
# + stdWrap
table = tt_address
# All properties from .select can be used directly
# + stdWrap
colPos = 1
pidInList = 13,14
# The target variable to be handed to the ContentObject again, can
# be used in Fluid e.g. to iterate over the objects. defaults to
# "records" when not defined
# + stdWrap
as = myrecords
# The fetched records can also be processed by DataProcessors.
# All configured processors are applied to every row of the result.
dataProcessing {
10 = TYPO3\CMS\Frontend\DataProcessing\FilesProcessor
10 {
references.fieldName = image
}
}
}
}
您可以将select
的所有参数用于该DataProcessor,并且可以使用stdWrap属性修改每个参数。 https://docs.typo3.org/typo3cms/TyposcriptReference/Functions/Select.html
只需确保将as = myrecords
替换为所需的变量名称,然后直接从Fluid模板中访问此变量。您可以使用<f:debug>{_all}</f:debug>
来概述可用变量。
另外,您可能需要查看此视频https://www.twitch.tv/videos/380759921以了解dataProcessing的内容。
由于FLUIDTEMPLATE方法是一个通用的方法,虽然问题可能与Flux更密切相关,但这里有一个特定于Flux的方式将信息移交给子记录:
https://fluidtypo3.org/viewhelpers/flux/master/Content/RenderViewHelper.html
<flux:content.render
area="NULL"
limit="123"
offset="123"
order="'sorting'"
sortDirection="'ASC'"
as="NULL"
loadRegister="{foo: 'bar'}"
render="1"
>
<!-- tag content - may be ignored! -->
</flux:content.render>
只需在名为loadRegister
的foo
中填写一些其他信息,以便在子渲染过程中通过getText方法register:foo
使其可用。
loadRegister="{parentRecordType: '2'}"
并在您的孩子记录渲染使用
10 = TEXT
10.dataWrap = My parent record is of type {register:parentRecordType}
如果条件或切换对象基于注册信息也是如此。当然,对于基于流体的儿童记录渲染也是如此。
只需使用<f:debug>_all</f:debug>
即可获得可用寄存器和数据的概述。
https://docs.typo3.org/typo3cms/TyposcriptReference/DataTypes/Index.html#register
是的,TYPO3可以在很多方面实现一切。内容元素是如何嵌套的?从父母到孩子(templavoila)或从孩子到父母(gridelements)?