0
votes

I build with an own extension a new field called "tx_references_special" in the table "sys_file_reference". In "textpic"-content elements in the backend of typo3 I can choose this field by checking this array at a picture in BE.So in the database the field "tx_references_special" is "0" or "1".

I'd like to define classes only for "with this array-chosen" pictures in textpic-elements. Therefore I build the following typoscript in my main-template-setup. The problem is, that only the class "default" is rendered for both pictures at this CE. Does anybody know, why?

lib.projects=CONTENT
lib.projects{
table = tt_content
select {
where = header_layout = 14
}  
renderObj = COA
renderObj {
10 = TEXT
10.field = header
10.wrap=<div id="header_projects">|</div>

20 = TEXT
20.field = bodytext
20.wrap=<div id="bodytext_projects">|</div>

30=FILES
30{
  references{
    table=tt_content
    fieldName=image
  }

  renderObj=CASE
  renderObj{
    key.data=sys_file_reference:tx_references_special

    default=IMAGE
    default {
      wrap=<div class="default">|</div>
      file{
        width=313m
        height=220m
        import.data=file:current:publicUrl
      }

    }

    1=IMAGE
    1 {
      wrap=<div class="itworks">|</div>
      file{
        width=313m
        height=220m
        import.data=file:current:publicUrl
      }
    }
  }
}
}
}
1

1 Answers

0
votes

Good morning,

I got it on another way.

My aim was to assign different classes for the pics to position them. With the following code it works. If I set the value in BE the picture get's the class app_pic and if I don't the picture gets the class icon.

lib.projects=CONTENT
lib.projects{
table = tt_content
select {
  where = header_layout = 14
}  
renderObj = COA
renderObj {
  10 = TEXT
  10.field = header
  10.wrap=<div id="header_projects">|</div>

  20 = TEXT
  20.field = bodytext
  20.wrap=<div id="bodytext_projects">|</div>

  30=FILES
  30{
    references{
      table=tt_content
      fieldName=image
    }

    renderObj=IMAGE
    renderObj{
      stdWrap.wrap=<div class="app_pic">|</div>
      stdWrap.wrap.override=<div class="icon">|</div>
      stdWrap.wrap.override.if {
        value=1
        equals.data=file:current:tx_references_special
      }
      file{
        width=313m
        height=220m
        import.data=file:current:publicUrl
      }
    }

    }
    }
    }