I have a menu with links which contain images set on page "media" field. There are also 2 fields called tx_hide_mobile and tx_hide_desktop. Depending on their value, I have to add css classes "hideonmobile" or "hideondesktop" or none. This is the typolink part of the menu items:
typolink.ATagParams.cObject = COA
typolink.ATagParams.cObject {
10 = IMG_RESOURCE
10 {
file {
import.cObject = FILES
import.cObject {
references {
table = pages
uid.field = uid
fieldName = media
}
renderObj = IMG_RESOURCE
renderObj {
file.width = 39
file.height = 39
required = 1
file.import.data = file:current:originalUid
}
}
}
}
wrap = class="mservice" style="background-image:url('{$protocol}://{$host}/|')"
wrap.cObject = COA
wrap.cObject {
10 = TEXT
10.value = class="mservice hideonmobile" style="background-image:url('{$protocol}://{$host}/|')"
10.if {
value.field = tx_hide_mobile
equals = 1
}
20 = TEXT
20.value = class="mservice hideondesktop" style="background-image:url('{$protocol}://{$host}/|')"
20.if {
value.field = tx_hide_desktop
equals = 1
}
}
}
How can I make the test for the mobile and desktop fields, and still keep the default value (with only mservice class) if none of the 2 fields is set?
Aucun commentaire:
Enregistrer un commentaire