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

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.

Related

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

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

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

Add image to menu/sitemap element in TYPO3

I am using TYPO3 4.7 (Upgrading is not an option). Can I customize the Menu/Sitemap element to include the first image on each linked page?
So In this case I'd be using:
tt_content.menu.20.1.1.NO
First of all you really should update the site as there are a lot security issues which can do harm to your/your customer's website.
Back to your question: Of course you can render any content inside a menu as well!
lib.menu = HMENU
lib.menu {
wrap = <ul>|</ul>
1 = TMENU
1.NO {
wrapItemAndSub = <li>|</li>
after.cObject = CONTENT
after.cObject {
table = tt_content
select {
pidInList.field = uid
}
renderObj = COA
renderObj {
10 = TEXT
10.field = header
10.htmlSpecialChars = 1
20 = TEXT
20 {
field = image
split {
token = ,
cObjNum = 1
1 {
10 = IMAGE
10 {
file {
import=uploads/pics/
import.current = 1
width = 170
height = 100
}
}
}
}
}
}
}
}
}
tt_content.menu.20.1.1.NO < lib.menu.1.NO
To be honest: the part with the image is untested as I don't have any non-FAL (since 6.0) installation anymore where I could test it.