Reputation: 568
I have a problem in my Typoscript and can not find nay solution. Here is an extract of my typoscript :
temp.my_class = TEXT
temp.my_class.value = my_custom_class
temp.my_class.wrap = class="|"
10 < styles.content.get
10.select.where = ( deleted = 0 && hidden = 0 && CType = 'image' )
10.select.andWhere = ( tx_gridelements_container = ###whatever### )
10.select.orderBy = sorting ASC
10.select.max = 1
10.select.markers.whatever.field = uid
10.renderObj = FILES
10.renderObj.references.table = tt_content
10.renderObj.references.fieldName = image
10.renderObj.renderObj = IMAGE
10.renderObj.renderObj.file.import.data = file:current:publicUrl
10.renderObj.renderObj.file.width = 200
10.renderObj.renderObj.params.cObject < temp.my_class
I use multiple ways but no success (with "lib" instead of "temp", with "=<", with "insertData" method ...) . By the way -> I can't use constants. Do you have an idea on how to make it ? Thanks for your help =)
Upvotes: 0
Views: 569
Reputation: 10790
first:
You need to use the copy operator <
to use some temp.
-objects.
References (=<
won't work as temp.
objects are not available at rendering time, just for the scanning of the typoscript.
And =
just assigns text and no object.
second:
Remember that <
only copies the defenition. if you copy an object definition to a simple text attribute you get the name of the object as value.
To avoid this either use .stdWrap
or .cObject
.
third:
Use wraps where the value is defined.
In your case it would be something like:
temp.my_class = TEXT
temp.my_class.field = my_custom_class
temp.my_class.wrap = class="|"
.... here other lines .....
10.renderObj.renderObj = IMAGE
10.renderObj.renderObj.file.import.data = file:current:publicUrl
10.renderObj.renderObj.file.width = 200
10.renderObj.renderObj.params.cObject < temp.my_class
this will result in:
10.renderObj.renderObj = IMAGE
10.renderObj.renderObj.file.import.data = file:current:publicUrl
10.renderObj.renderObj.file.width = 200
10.renderObj.renderObj.params.cObject = TEXT
10.renderObj.renderObj.params.cObject.field = my_custom_class
10.renderObj.renderObj.params.cObject.wrap = class="|"
but I think you really want this (no cObject
):
10.renderObj.renderObj = IMAGE
10.renderObj.renderObj.file.import.data = file:current:publicUrl
10.renderObj.renderObj.file.width = 200
10.renderObj.renderObj.params.field = my_custom_class
10.renderObj.renderObj.params.wrap = class="|"
so your extraction of the fieldname with a temp-object (to simulate a constant) would be either:
temp.my_class_field = my_custom_class
:
10.renderObj.renderObj.params.field < temp.my_class_field
10.renderObj.renderObj.params.wrap = class="|"
or
temp.my_class {
field = my_custom_class
wrap = class="|"
}
:
10.renderObj.renderObj.params < temp.my_class
Upvotes: 2
Reputation: 3354
Try following:
10.renderObj.renderObj.params.cObject < tmp.my_class
10.renderObj.renderObj.params.cObject.wrap = class="|"
Upvotes: 0