[TYPO3-english] Condition based on Content Element Layout

bernd wilke t3ng at bernd-wilke.net
Thu Oct 23 11:29:33 CEST 2014


Am 23.10.14 09:12, schrieb Adrian:
> Is it possible to set condition who will based on Content Element Layout
> (Default, Layout 1, Layout, 2 etc..)? I try wit this code, but it didn't
> work:
>
> [globalVar = TCEFORM.tt_content.layout = 1]
> ...
> [global]
>

you can't use conditions on fields of single contentelements, as those 
are not known when conditions are evaluated, and also because there 
possibly are more than one CE (with different settings).

the correct way (as Bert already wrote) is to enhance the rendering of 
the CE (all beyond tt_content) with stdWrap.if
depending on the type of CE and depending on the changes you want to do 
you insert the stdWrap.if
you may use overrides like Bert or have different wraps or wrapstrings 
build from COA with parts depending on layout values

e.g.

...wrap.cObject = COA
...wrap.cObject {
	10 = TEXT
	10.value = <div class="primary_layout">|</div>
	10.if {
		isInList.field = layout
		value = 1
	}

	20 = TEXT
	20.value = <span class="secondary_layout">|</span>
	20.if {
		isInList.field = layout
		value = 2
	}
	
	30 < .10
	30.value = <h1 class="third_layout">|</h1>
	30.if.value = 3

	:
}

bernd
-- 
http://www.pi-phi.de/cheatsheet.html


More information about the TYPO3-english mailing list