How do I override HMENU Special setting based on layout? - typo3

I have a menu element that is set to list the selected pages.
tt_content.my_menu {
dataProcessing {
10 = TYPO3\CMS\Frontend\DataProcessing\MenuProcessor
10 {
special = list
special.value.field = pages
}
}
}
How can I change this to a directory of pages when a specific layout is set?
tt_content.my_menu {
dataProcessing {
10 {
special {
override = directory
override.if.value = my-layout
override.if.equals.field = layout
}
}
}
}

I'm not sure if MenuProcessor? has stdWrap on its properties.
But it should be possible to define two processors, each with an if:
tt_content.my_menu {
dataProcessing {
10 = TYPO3\CMS\Frontend\DataProcessing\MenuProcessor
10 {
if {
value = my-layout
equals.field = layout
negate = 1
}
special = list
special.value.field = pages
}
20 = TYPO3\CMS\Frontend\DataProcessing\MenuProcessor
20 {
if {
value = my-layout
equals.field = layout
}
special = directory
special.value.field = pages
}
}
}

Related

TypoScript condition to check if specific list_type is on a page

I try to have a condition in TypoScript to find out if a certain list_type is on the page (plugin). In the docs I can't find anything about that. Is it even possible at all?
lib.hasNewsOnPage = TEXT
lib.hasNewsOnPage {
value = 1
if.isTrue.numRows {
table = tt_content
select.where.dataWrap = pid = {TSFE:id} AND colPos = 1 AND list_type = 'news_pi1'
}
}
Try this:
Return 1 if the plugin News is fund on the current page (colpos 1)
lib.hasNewsOnPage = TEXT
lib.hasNewsOnPage {
value = 0
stdWrap {
override {
cObject = CONTENT
cObject {
table = tt_content
select {
where = colPos=1 AND list_type = 'news_pi1'
max = 1
}
renderObj = TEXT
renderObj {
value = 1
}
}
}
}
}

Set levels property for menu_subpages depdending on layout

I have the following typoscript configuration for the menu_subpages object:
tt_content.menu_subpages {
dataProcessing {
10 {
levels = 1
as = menu
expandAll = 1
includeSpacer = 1
}
}
}
To give the editor more flexibility I want to set the levels property depending on the selected layout of the content object. I've tried to use the CASE object but this doesn't seem to work:
tt_content.menu_subpages {
dataProcessing {
10 {
levels = CASE
levels {
key.field = layout
default = TEXT
default.value = 1
1000 = TEXT
1000.value = 7
}
...
}
}
}
Thanks for any help!
As levels is no object but a property you can't use it as an object.
Either you change it to an object:
tt_content.menu_subpages {
dataProcessing {
10 {
levels.cObject = CASE
levels.cObject {
:
}
...
}
}
}
Or you need to set the value inside a typoscript condition.
tt_content.menu_subpages {
dataProcessing {
10 {
// default:
levels = 1
...
}
}
}
[page['layout'] == 1000]
tt_content.menu_subpages.dataProcessing.10.levels = 7
[page['layout'] = 2000]
tt_content.menu_subpages.dataProcessing.10.levels = 3
[global]

TYPO3 News Title in breadcrumb with MenuProcessor

is it possible to show the current news title in breadcumb with the MenuProcessor?
I've tried some with DatabaseQueryProcessor but I don't get the data.
Have someone a working example or a tutorial for me?
At the moment I have only this:
temp.breadcrumb = FLUIDTEMPLATE
temp.breadcrumb {
templateName = breadcrumb
templateRootPaths {
10 = fileadmin/resources/private/template/menu/
}
partialRootPaths {
10 = fileadmin/resources/private/template/partials/
}
dataProcessing {
10 = TYPO3\CMS\Frontend\DataProcessing\MenuProcessor
10 {
special = rootline
special.range = 0|-1
includeNotInMenu = 1
as = menuBreadcrumb
}
dataProcessing {
10 = TYPO3\CMS\Frontend\DataProcessing\DatabaseQueryProcessor
10 {
if.isTrue.field = records
table = tx_news_domain_model_news
}
}
}
}

MaxGalleryWidth for fluid_styled_content

I tried to change the MaxGalleryWidth in fluid_styled_content for an specific column.
First I tried how I do this before fluid_styled_content:
lib.contentRight = COA
lib.contentRight {
10 = LOAD_REGISTER
10 {
maxImageWidth = 205
maxImageWidthInText = 60
}
20 < styles.content.get
20 {
select {
where = colPos=1
}
slide = -1
}
90 = RESTORE_REGISTER
}
Also using maxGalleryWidth in LOAD_REGISTER has no effect.
This doesn't work for me. Than I tried to set the maxGalleryWidth Parameter for the GalleryProcessor, but this seems not to have any effect:
lib.contentRight < styles.content.get
lib.contentRight {
select {
where = colPos=1
}
slide = -1
renderObj = < tt_content
renderObj.textmedia.dataProcessing.20 {
maxGalleryWidth = 205
maxGalleryWidthInText = 60
}
}
Finaly I got it only to work with an override and if condition:
tt_content.textmedia.dataProcessing.20 {
maxGalleryWidth.override.cObject = TEXT
maxGalleryWidth.override.cObject {
value = 205
if {
value = 1
equals.field = colPos
}
}
maxGalleryWidthInText.override.cObject = TEXT
maxGalleryWidthInText.override.cObject {
value = 60
if {
value = 1
equals.field = colPos
}
}
}
For me it looks wrong, are there other ways to realize it correctly without using override?

Image processing configuration

I need help with image processing configuration in Typo3 7.6.4. All images are being processed no matter how big they are. That causes that the images are not in original size and unsharp, renamed and copied in processed folder. I would like to configure image processing so that it is activated only if images have some specific size (px or kb/mb). For example if image have more than 1MB or if the is width more than 800px, than processed it otherwise leave it as it is and link to original file (no copy, no processing). Thanks
page.10 = FLUIDTEMPLATE
page.10 {
template = CASE
template {
key.data = levelfield:-1,backend_layout_next_level,slide
key.override.field = backend_layout
1 = FILE
1.file = fileadmin/templates/sitename/main_1_column.html
2 = FILE
2.file = fileadmin/templates/sitename/main_2_column.html
}
partialRootPath = fileadmin/templates/sitename/partials/
layoutRootPath = fileadmin/templates/sitename/layouts/
variables {
siteName = TEXT
siteName.value = sitename
header < styles.content.get
header.select.where = colPos = 0
contentMain < styles.content.get
contentMain.select.where = colPos = 1
content_column_1 < styles.content.get
content_column_1.select.where = colPos = 1
content_column_2 < styles.content.get
content_column_2.select.where = colPos = 2
footer < styles.content.get
footer.select.where = colPos = 3
}
}
tt_content {
stdWrap {
innerWrap {
cObject {
default.20.40 = CASE
default.20.40 {
key.field = layout
default = TEXT
default.value = img-responsive
}
}
}
innerWrap2 >
}
image {
20 {
1 {
params.cObject = TEXT
params.cObject {
wrap = class="|"
cObject < tt_content.stdWrap.innerWrap.cObject.default.20.40
}
sourceCollection >
sourceCollection {
big {
maxW = 5000
dataKey = big
}
small {
maxW = 500
dataKey = small
}
smallLandscape {
maxW = 800
dataKey = smallLandscape
}
}
}
maxW = 5000
}
}
}