从嵌入式记录中获取媒体或图像

问题描述 投票:0回答:1

在一个单独的内容元素中,我使用内联记录。使用此数据处理器可实现流体模板中的输出:

    20 = TYPO3\CMS\Frontend\DataProcessing\DatabaseQueryProcessor
    20 {
        table = tx_mytable
        pidInList.field = pid
        where {
            data = field:uid
            intval = 1
            wrap = tt_content=|
        }
        orderBy = sorting
    }

对于文本字段,此功能可以正常工作,但不适用于媒体或图像。媒体或图像本身就是内联记录-内联记录中的内联记录...

是否有可能在内联记录中获取媒体或图像字段的记录?

这显然不起作用:

    30 = TYPO3\CMS\Frontend\DataProcessing\FilesProcessor
    30 {
        references.fieldName = media
        as = files
    }

仅适用于主记录中的媒体或图像,而不适用于链接的嵌入式记录中的介质或图像。后端和TCA正常工作,链接的内联记录中的链接媒体正确显示。但是在流体中,我只得到[media] =1。

任何想法如何解决这个问题?

typo3 typo3-8.x typo3-9.x
1个回答
0
投票

我找到了解决方案:可以嵌套数据处理器:

    20 = TYPO3\CMS\Frontend\DataProcessing\DatabaseQueryProcessor
    20 {
        table = tx_mytable
        pidInList.field = pid
        where {
            data = field:uid
            intval = 1
            wrap = tt_content=|
        }
        orderBy = sorting
        dataProcessing {
            10 = TYPO3\CMS\Frontend\DataProcessing\FilesProcessor
            10 {
                references.fieldName = media
                as = files
            }
        }
    }

这有效。

© www.soinside.com 2019 - 2024. All rights reserved.