[TYPO3-dev] FAL in an Extbase 6.0 extension... but how?!

Andreas Kiessling andreas.kiessling at web.de
Thu Jan 31 20:39:55 CET 2013


Hi,

i used a different approach to render images/files (for read-only access):


<f:cObject typoscriptObjectPath="lib.singleImage" data="{uid:
yourObject.uid}" />

lib.singleImage = FILES
lib.singleImage{
  references {
    table = your_table
    uid.field = uid
    fieldName = your_field
  }

  renderObj = COA
  renderObj {
    10 = IMAGE
    10 {
      file.import.data = file:current:publicUrl
      file.maxW = 281
      altText.data = file:current:alternative
      titleText.data = file:current:title
    }
  }
}


The only real "problems" i encountered were:

- if you need to support multilanguage, add something like this to your
model, because .uid always is always set to the one from default language:

/**
 * Returns the real uid for the record to use with FAL TS
 *
 * @return \integer
 */
public function getRealUid() {
	return ($this->_localizedUid ? $this->_localizedUid : $this->uid);
}
and pass uid: model.realUid from the ViewHelper

- I tried to pass a whole "news" model to the cObject ViewHelper and got
stuck with some weird DateTime conversion/mapping errors, so i went for
the uid due to lack of time to investigate further.

- probably not working with workspaces (luckily i did not need that
right now)


Have a look at tt_content.uploads.20 for a lot of examples (or the TS
documentation
http://docs.typo3.org/typo3cms/TyposcriptReference/ContentObjects/Files/Index.html
) and ContentObjectRenderer->getFileDataKey for possible fields to use
(or just use the columns like in the db, e.g. if you extend
sys_file_reference)

HTH,
Andreas



More information about the TYPO3-dev mailing list