Feature #20438 ยป feature11107-imgtextRenderingTypoScript.patch
typo3/sysext/css_styled_content/pi1/class.tx_cssstyledcontent_pi1.php (working copy) | ||
---|---|---|
$imgPath = $this->cObj->stdWrap($conf['imgPath'], $conf['imgPath.']);
|
||
// Does we need to render a "global caption" (below the whole image block)?
|
||
$wantsGlobalCaption = !$conf['captionSplit'] && !$conf['imageTextSplit'] && is_array($conf['caption.']);
|
||
if ($imgCount == 1) {
|
||
// If we just have one image, the caption relates to the image, so it is not "global"
|
||
$wantsGlobalCaption = false;
|
||
}
|
||
// Use the calculated information (amount of images, if global caption is wanted) to choose a different rendering method for the images-block
|
||
$GLOBALS['TSFE']->register['imageCount'] = $imgCount;
|
||
$GLOBALS['TSFE']->register['wantsGlobalCaption'] = $wantsGlobalCaption;
|
||
$fallbackRenderMethod = $this->cObj->cObjGetSingle($conf['fallbackRendering'], $conf['fallbackRendering.']);
|
||
if ($fallbackRenderMethod && is_array($conf['rendering.'][$fallbackRenderMethod . '.'])) {
|
||
$conf = $this->cObj->joinTSarrays($conf, $conf['rendering.'][$fallbackRenderMethod . '.']);
|
||
}
|
||
// Global caption
|
||
$caption = '';
|
||
if (!$conf['captionSplit'] && !$conf['imageTextSplit'] && is_array($conf['caption.'])) {
|
||
$caption = $this->cObj->stdWrap($this->cObj->cObjGet($conf['caption.'], 'caption.'), $conf['caption.']);
|
||
$globalCaption = '';
|
||
if ($wantsGlobalCaption) {
|
||
$globalCaption = $this->cObj->stdWrap($this->cObj->cObjGet($conf['caption.'], 'caption.'), $conf['caption.']);
|
||
}
|
||
// Positioning
|
||
... | ... | |
$thisImage = '';
|
||
$thisImage .= $this->cObj->stdWrap($imgsTag[$imgKey], $conf['imgTagStdWrap.']);
|
||
if ($conf['captionSplit'] || $conf['imageTextSplit']) {
|
||
if (!$wantsGlobalCaption) {
|
||
$thisImage .= $this->cObj->stdWrap($this->cObj->cObjGet($conf['caption.'], 'caption.'), $conf['caption.']);
|
||
}
|
||
if ($editIconsHTML) {
|
||
... | ... | |
}
|
||
// Add the global caption, if not split
|
||
if ($caption) {
|
||
$images .= $caption;
|
||
if ($globalCaption) {
|
||
$images .= $globalCaption;
|
||
}
|
||
// CSS-classes
|
typo3/sysext/css_styled_content/static/setup.txt (working copy) | ||
---|---|---|
rendering {
|
||
dl {
|
||
# Choose another rendering for special edge cases
|
||
fallbackRendering = COA
|
||
fallbackRendering {
|
||
# Just one image without a caption => don't need the dl-overhead, use the "simple" rendering
|
||
10 = TEXT
|
||
10 {
|
||
if {
|
||
isFalse.field = imagecaption
|
||
value = 1
|
||
equals.data = register:imageCount
|
||
}
|
||
value = simple
|
||
}
|
||
# Multiple images and one global caption => "ul"
|
||
20 = TEXT
|
||
20 {
|
||
if {
|
||
value = 1
|
||
isGreaterThan.data = register:imageCount
|
||
isTrue.if.isTrue.data = register:wantsGlobalCaption
|
||
isTrue.field = imagecaption
|
||
}
|
||
value = ul
|
||
}
|
||
|
||
# Multiple images and no caption at all => "ul"
|
||
30 = TEXT
|
||
30 {
|
||
if {
|
||
value = 1
|
||
isGreaterThan.data = register:imageCount
|
||
isFalse.field = imagecaption
|
||
}
|
||
value = ul
|
||
}
|
||
}
|
||
imageRowStdWrap.dataWrap = <div class="csc-textpic-imagerow" style="width:{register:rowwidth}px;"> | </div>
|
||
imageLastRowStdWrap.dataWrap = <div class="csc-textpic-imagerow csc-textpic-imagerow-last" style="width:{register:rowwidth}px;"> | </div>
|
||
noRowsStdWrap.wrap =
|
||
... | ... | |
}
|
||
}
|
||
ul {
|
||
# Just one image without a caption => don't need the ul-overhead, use the "simple" rendering
|
||
fallbackRendering < tt_content.image.20.rendering.dl.fallbackRendering.10
|
||
imageRowStdWrap.dataWrap = <div class="csc-textpic-imagerow" style="width:{register:rowwidth}px;"><ul> | </ul></div>
|
||
imageLastRowStdWrap.dataWrap = <div class="csc-textpic-imagerow csc-textpic-imagerow-last" style="width:{register:rowwidth}px;"><ul> | </ul></div>
|
||
noRowsStdWrap.wrap = <ul> | </ul>
|
||
... | ... | |
caption.wrap = <div class="csc-textpic-caption"> | </div>
|
||
}
|
||
div {
|
||
# Just one image without a caption => don't need the ul-overhead, use the "simple" rendering
|
||
fallbackRendering < tt_content.image.20.rendering.dl.fallbackRendering.10
|
||
imageRowStdWrap.dataWrap = <div class="csc-textpic-imagerow" style="width:{register:rowwidth}px;"> | </div>
|
||
imageLastRowStdWrap.dataWrap = <div class="csc-textpic-imagerow csc-textpic-imagerow-last" style="width:{register:rowwidth}px;"> | </div>
|
||
noRowsStdWrap.wrap =
|
||
... | ... | |
editIconsStdWrap.wrap = <div> | </div>
|
||
caption.wrap = <div class="csc-textpic-caption"> | </div>
|
||
}
|
||
simple {
|
||
imageRowStdWrap.dataWrap = |
|
||
imageLastRowStdWrap.dataWrap = |
|
||
noRowsStdWrap.wrap =
|
||
oneImageStdWrap.dataWrap = |
|
||
imgTagStdWrap.wrap = |
|
||
editIconsStdWrap.wrap = |
|
||
caption.wrap = <div class="csc-textpic-caption"> | </div>
|
||
#imageStdWrap.dataWrap = |
|
||
}
|
||
}
|
||
renderMethod = dl
|
||