I have following fluid script to insert a typoscript lib:
<f:cObject typoscriptObjectPath="lib.artteaser" data="{imgclass: 'img-cover'}"/>
I want to use the "data" parameter in a typoscript within FILES.renderObj
for the wrap as a css class - the following is what I've tried so far, but it didnt work.
lib.artteaser = COA
lib.artteaser {
wrap = <section><div class="container"><div class="row cover-teaserbox">|</div></div></section>
10 = CONTENT
10 {
table = tt_content
select {
[...]
}
renderObj = COA
renderObj {
wrap = <div class="col-xs-12 col-sm-6 col-md-4 col-lg-3 col-xl-3 cover-teaserbox-item">|</div>
10 = FILES
10 {
references {
[...]
}
renderObj = IMAGE
renderObj {
file.import.data = file:current:uid
file.crop.data = file:current:crop
file.treatIdAsReference = 1
altText.data = file:current:title
# the following did not work
stdWrap.dataWrap = <div class="cover-teaserbox-item-img {field:imgclass}">|</div>
stdWrap.typolink {
parameter.field = pid
}
}
maxItems = 1
}
[...]
}
}
}
Can somebody give me a hint to get this to work? Thank you in advance!
Everytime you use current
or field:*
or data = *
you need to consider context.
On entering your TS object you have all your 'parameters' as current context. but as soon as you build a menu or work on records (CONTENT
) the single record (page record in case of menus) is the current context.
In your case you can store your parameter to a register and use it later.
lib.artteaser = COA
lib.artteaser {
5 = LOAD_REGISTER
5 {
imageClass.field = imgclass
}
10 = CONTENT
10 {
:
:
stdWrap.dataWrap = <div class="cover-teaserbox-item-img {register:imageClass}">|</div>
:
:
}
}