简体   繁体   中英

TYPO3 Text Media Element should get class from selected sys category

I want to reach the following: I'm creating an new content element "text media", fill out title, text and perhaps select an image. I also created categories which I select under the tab "categories". Now I want to integrate these selected categories in the fluid template to make it work as an javascript filter.

How can I achieve this task?

Thanks!

You can use a DataProcessor to get the category data. You need to extend the TypoScript for the textmedia element.

Category example: https://git.spooner.io/spooner/just_news/blob/master/Configuration/TypoScript/RenderingDefinitions/news_list.ts#L23

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

Here you can see the default textmedia TS, added object 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
        }
    }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM