TYPO3 Text Media Element应该从选定的sys类别中获取类

时间:2017-08-03 18:18:00

标签: class typo3 categories fluid

我想达到以下目标: 我正在创建一个新的内容元素"文本媒体",填写标题,文本并可能选择一个图像。我还创建了我在选项卡"类别"下选择的类别。 现在我想在流体模板中集成这些选定的类别,使其作为javascript过滤器。

我该如何完成这项任务?

谢谢!

1 个答案:

答案 0 :(得分:1)

您可以使用DataProcessor获取类别数据。您需要扩展textmedia元素的TypoScript。

类别示例:https://git.spooner.io/spooner/just_news/blob/master/Configuration/TypoScript/RenderingDefinitions/news_list.ts#L23

DataProcessor文档:https://docs.typo3.org/typo3cms/TyposcriptReference/ContentObjects/Fluidtemplate/Index.html#dataprocessing

在这里你可以看到默认的textmedia TS,添加了对象30:

# Text & Media:
# Any number of media wrapped right around a regular text element.
#
# CType: textmedia

tt_content.textmedia =< lib.contentElement
tt_content.textmedia {
templateName = Textmedia
    dataProcessing {
        10 = TYPO3\CMS\Frontend\DataProcessing\FilesProcessor
        10 {
            references.fieldName = assets
        }
        20 = TYPO3\CMS\Frontend\DataProcessing\GalleryProcessor
        20 {
            maxGalleryWidth = {$styles.content.textmedia.maxW}
            maxGalleryWidthInText = {$styles.content.textmedia.maxWInText}
            columnSpacing = {$styles.content.textmedia.columnSpacing}
            borderWidth = {$styles.content.textmedia.borderWidth}
            borderPadding = {$styles.content.textmedia.borderPadding}
        }
        # Get categories
        30 = TYPO3\CMS\Frontend\DataProcession\DatabaseQueryProcessor
        30 {
            put the login in...
        } 
    }
    stdWrap {
        editIcons = tt_content: header [header_layout], bodytext, assets [imageorient|imagewidth|imageheight], [imagecols|imageborder], image_zoom
        editIcons {
            iconTitle.data = LLL:EXT:fluid_styled_content/Resources/Private/Language/FrontendEditing.xlf:editIcon.textmedia
        }
    }
}