Search code examples
typo3typo3-6.1.x

Typo3 resources media files/sys_file_reference for TMENU


How can I use resources media files -> Description (Caption) for altTag/altText in menu.

In TYPO3 you have the possibility to use the page properties for a resource image and to set additional metadata. I found this reference: data [sys_file_reference] [6] [description]

NO = 1 
NO {
   ATagTitle.field = title
   wrapItemAndSub = |</li>
   allWrap = <li>| 
   after.cObject = IMAGE 
   after.cObject {
      file.import.field = media
      file.import = uploads/media/ 
      file.import.listNum = 0
      file.width = 250c 
      altText = {???:description}
      altText.insertData = 1 
   }
   stdWrap.htmlSpecialChars = 1
}

Solution

  • Since TYPO3 6.0 the media field uses File Abstraction Layer (FAL) to create references to uploaded objects (e.g. images). Because of this change, you can't use the IMAGE content object to fetch the inserted object, but first have to use the FILES content object.

    For you case, the TypoScript should look like this:

      after.cObject = FILES 
      after.cObject {
        references.data =  levelmedia:-1, slide
        references.listNum = 0
        renderObj = IMAGE
        renderObj.altText.data = file:current:description
        renderObj.file {
          import.data = file:current:publicUrl
          width = 250c
        }
      } 
    

    References: http://docs.typo3.org/typo3cms/TyposcriptReference/ContentObjects/Files/Index.html