0
votes

I want to create an option to add an image with no wrap or a wrap of my choosing, overriding css styled content.

I have seen this other question but the method removes wraps from all images: How to remove div around an image in typo3?

How can I modify this to be used only when a chosen content element layout is selected?

# Remove some wraps
tt_content.image.20.imageStdWrap.dataWrap >
tt_content.image.20.imageStdWrapNoWidth.dataWrap >
tt_content.image.20.imageColumnStdWrap.dataWrap >

# Redefine the layout switch with only one default case
tt_content.image.20.layout >
tt_content.image.20.layout = CASE
tt_content.image.20.layout.key.field = imageorient
tt_content.image.20.layout.default = TEXT
tt_content.image.20.layout.default.value = ###IMAGES### ###TEXT###

# Remove the wrap around the image subtext
tt_content.textpic.20.text.wrap = |

# Define a new rendering method without wraps
tt_content.image.20.rendering.noWraps {
  imageRowStdWrap.dataWrap = |
  noRowsStdWrap.wrap =
  oneImageStdWrap.dataWrap = |
  imgTagStdWrap.wrap = |
  editIconsStdWrap.wrap = |
  caption.wrap = |
}
# Set this as active rendering method
tt_content.image.20.renderMethod = noWraps
1

1 Answers

1
votes

I recommend not using css_styled_content (CSC) anymore. As discussed here you should upgrade your TYPO3 installation to 7.6 and start using fluid_styled_content (FSC). With TYPO3 7.4 or 7.5 FSC got introduced and is way better, since the whole rendering is based on fluid templates rather than TypoScript. So make sure to solely use FSC. In later versions, CSC will be moved to EXT:compatibilityX and will sooner or later be gone.

As soon as you switched your templating to FSC you can override the partial path and copy a version of this file to your theme/ site package. Now you can easily implement the changes you need to do without any TypoScript. The {data} oject contains all necessary information regarding the tt_content element. This will help you to come up with mighty conditions ;)