TYPO3: I need to add typoscript lines to object with a custom extension - typo3

I added an image selection to a content element in my main extension with a custom extension, this field should now be added in the dataProcessing that is performed in the main extension, but it should be added in the custom extension :
tt_content.t3bs_carousel < lib.contentElement
tt_content.t3bs_carousel {
templateName = Carousel
templateRootPaths {
9 = {$plugin.tx_t3bs_main.view.templateRootPath}Content/
8 = EXT:t3bs_main/Resources/Private/Templates/Content/
}
dataProcessing {
10 = TYPO3\CMS\Frontend\DataProcessing\FilesProcessor
10 {
references.fieldName = assets
as = assets
}
// this 20 should be added by the custom extension
20 = TYPO3\CMS\Frontend\DataProcessing\FilesProcessor
20 {
references.fieldName = tx_t3bs_portrait_image
as = portrait
}
90 >
}
}
if I safe this in the main extension it works, I cannot find a typoscript that makes me add it in my custom extension, I tried to insert the entire object (since my custom extension is loaded after the main), then also only the missing part that needs to be added:
tt_content.t3bs_carousel.dataProcessing {
20 = TYPO3\CMS\Frontend\DataProcessing\FilesProcessor
20 {
references.fieldName = tx_t3bs_portrait_image
as = portrait
}
}

Related

typo3 TypoScript creating a menu for subpages from any page of any level

I try to get the children to the actual page.
This is my best try:
10 {
dataProcessing {
100 = TYPO3\CMS\Frontend\DataProcessing\MenuProcessor
100 {
levels = 1
entryLevel = page:level
includeSpacer = 1
includeNotInMenu = 0
as = children
expandAll = 0
}
}
}
I tried to get the menu level of the current page, but I couldn't find something in the documentation that is helping.
Do you have an idea?
My goal is to create a menu for all subpages at the next level.
Thank you for your time :-)
Adjusted solution:
10 {
dataProcessing {
100 = TYPO3\CMS\Frontend\DataProcessing\MenuProcessor
100 {
as = children
special = directory
special.value.field = pages
dataProcessing {
10 = TYPO3\CMS\Frontend\DataProcessing\FilesProcessor
10 {
references.fieldName = media
}
}
}
props #Thomas Löffler
Danke ;-)
there is a content element in TYPO3 named "menu of subpages" which is integrated in TypoScript as well.
What I got from the core (https://github.com/TYPO3/typo3/blob/main/typo3/sysext/fluid_styled_content/Configuration/TypoScript/ContentElement/MenuSubpages.typoscript):
tt_content.menu_subpages =< lib.contentElement
tt_content.menu_subpages {
templateName = MenuSubpages
dataProcessing {
10 = menu
10 {
special = directory
special.value.field = pages
dataProcessing {
10 = files
10 {
references.fieldName = media
}
}
}
}
}
If you don't want to display any images you can remove the files part.
Beware that the example is taken from latest version. There you can replace the dataprocessor class names.

Fluid menu element with image from page resources?

I've created a new fluid menu element and I need it to show an image for each page. The image is stored in the page resources.
When I debug the template, each menu item shows data.media => 1 but media cannot be expanded any further. How can I get the image to render in my template?
TS:
ext_menu_image < lib.contentElement
ext_menu_image {
templateName = MenuImage
dataProcessing {
10 = TYPO3\CMS\Frontend\DataProcessing\MenuProcessor
10 {
special = directory
special.value.field = pages
levels = 1
as = menuItems
expandAll = 1
titleField = nav_title // title
}
}
}
Template:
<f:for each="{menuItems}" as="page">
{f:uri.image(image:page.data.media.???)}
</f:for>
By default the MenuProcessor just puts the data directly from the table into the array in Fluid. The media field in the pages table, just holds the number of relations. So you need another data processor so it is translated to a file. This should do it:
ext_menu_image < lib.contentElement
ext_menu_image {
templateName = MenuImage
dataProcessing {
10 = TYPO3\CMS\Frontend\DataProcessing\MenuProcessor
10 {
special = directory
special.value.field = pages
levels = 1
as = menuItems
expandAll = 1
titleField = nav_title // title
dataProcessing {
10 = TYPO3\CMS\Frontend\DataProcessing\FilesProcessor
10 {
references.fieldName = media
}
}
}
}
}

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
}
}
}

TYPO3: Multiple references for fieldName?

Inside a custom content element, I use two fields: image and media
My setup.txt looks like this:
custom_ce {
templateName = CustomCe
dataProcessing {
10 = TYPO3\CMS\Frontend\DataProcessing\FilesProcessor
10 {
references.fieldName = media
}
20 = Vendor\Ext\DataProcessing\CustomCeProcessor
}
}
Currently I managed to process only one field. Is it possible to pass both media and image fields to the filesProcessor ?
You can call a DataProcessor more than once and you can specify the varibale the files are available in your fluid template with the as key:
custom_ce {
templateName = CustomCe
dataProcessing {
10 = TYPO3\CMS\Frontend\DataProcessing\FilesProcessor
10 {
references.fieldName = media
as = media
}
15 = TYPO3\CMS\Frontend\DataProcessing\FilesProcessor
15 {
references.fieldName = image
as = image
}
20 = Vendor\Ext\DataProcessing\CustomCeProcessor
}
}

TYPO3 : How to create a header image that will be inherited by sub pages

I have to set up a TypoScript-configuration for a header image with the following requirements:
The editor should be able to define a header image for a page using the "edit page-properties->resources->media" dialogue. If a page doesn`t have a header image, the parent pages should be scanned for header images and the first header image found on the way up to the page-tree root should be used.
Editors should also be able to add content elements to a certain "Page Header" section. This content elements can either be slider/menus or images. If a content element of the type "image" or "text with image" is added, only the image itself and no other additional code should be rendered. The content elements added to the page-header section should have priority. So if a page contains a content element in the page-header section and also has an image in the resources->media field, the image from the media-field of that page or any other page on a higher level in the page tree will be ignored and the content element/image from the page-header section will be rendered.
Fallback: if there is no content in the page-header section and also no images can be found in the media field of the page or other pages in it`s rootline, a default image which is defined via a TypoScript constant should be rendered to prevent that the header section will be left empty.
This TypoScript uses override, slide and a nested COA object to render a header image in a way that meets the given requirements:
lib.fallBackHeaderImage = IMAGE
lib.fallBackHeaderImage {
file {
import.cObject = TEXT
import.cObject.value = {$portal.context.headerImage.filename}
maxW = 1124
maxH = 342
}
}
lib.headerImage = IMAGE
lib.headerImage {
file {
import {
data = levelmedia:-1, slide
listNum = 0
}
treatIdAsReference = 1
maxW = 1124
maxH = 342
}
}
lib.headerContent < styles.content.getLeft
lib.headerContent {
renderObj < tt_content
renderObj {
image >
image = FILES
image {
references {
table = tt_content
fieldName = image
uid.data = uid
}
renderObj = IMAGE
renderObj {
file {
import.data = file:current:originalUid // file:current:uid
maxW = 1124
maxH = 342
}
}
}
textpic >
textpic < .image
}
}
lib.pageHeader = COA
lib.pageHeader {
// 10 reserved for prepend content
20 = COA
20 {
10 = COA
10 {
10 < lib.fallBackHeaderImage
stdWrap {
override {
required = 1
cObject < lib.headerImage
}
}
}
stdWrap {
override {
required = 1
cObject < lib.headerContent
}
}
}
// 30 reserved for appended content
}