### Eclipse Workspace Patch 1.0 #P TYPO3-trunk Index: typo3/sysext/css_styled_content/pi1/class.tx_cssstyledcontent_pi1.php =================================================================== --- typo3/sysext/css_styled_content/pi1/class.tx_cssstyledcontent_pi1.php (revision 5415) +++ typo3/sysext/css_styled_content/pi1/class.tx_cssstyledcontent_pi1.php (working copy) @@ -446,10 +446,25 @@ $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 @@ -738,7 +753,7 @@ $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) { @@ -781,8 +796,8 @@ } // Add the global caption, if not split - if ($caption) { - $images .= $caption; + if ($globalCaption) { + $images .= $globalCaption; } // CSS-classes Index: typo3/sysext/css_styled_content/static/setup.txt =================================================================== --- typo3/sysext/css_styled_content/static/setup.txt (revision 5415) +++ typo3/sysext/css_styled_content/static/setup.txt (working copy) @@ -572,6 +572,43 @@ 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 =
|
imageLastRowStdWrap.dataWrap =
|
noRowsStdWrap.wrap = @@ -584,6 +621,8 @@ } } 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 =
imageLastRowStdWrap.dataWrap =
noRowsStdWrap.wrap = @@ -593,6 +632,8 @@ caption.wrap =
|
} 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 =
|
imageLastRowStdWrap.dataWrap =
|
noRowsStdWrap.wrap = @@ -601,6 +642,16 @@ editIconsStdWrap.wrap =
|
caption.wrap =
|
} + simple { + imageRowStdWrap.dataWrap = | + imageLastRowStdWrap.dataWrap = | + noRowsStdWrap.wrap = + oneImageStdWrap.dataWrap = | + imgTagStdWrap.wrap = | + editIconsStdWrap.wrap = | + caption.wrap =
|
+ #imageStdWrap.dataWrap = | + } } renderMethod = dl