blog.Resource

Archive:

News-Feeds:


RSS 2.0
RSS 0.91
RDF
ATOM 0.3
May 29, 2013

FAL and Extbase - the easy part

Category: Extbase

By: Anja Leichsenring

You want to use FAL in your extension? Here is how to display images and link files in Fluid view.

Since FAL became part of the TYPO3 core in version 6.0, extension authors want to use the new API in their extension. With Extbase version 6.1 the FileReference Model was introduced, providing this API to deal with files in views nearly transparent the old way and the FAL way.

This article tackles the question how to prepare a model to use FAL images in an objectStorage and display them via Fluid.

After the buzz environment does not deal very well with source code, the snippets are collected in a gist document

First thing to do is to declare a field in your table sql and its TCA as a FAL images field. 

Second is to provide a property in the model. Don't forget to init the objectStorage.

Last, but not least: pass the object holding the property to your view and let it render the images in a for-loop using the ImageViewHelper.

In this way you can easily deal with all kind of files and fileReferences in Extbase context. For the scope of this little tutorial, you have to fill the data using the TYPO3 backend. Writing FAL access will be the topic of another article. Stay tuned and let us know about your experience in the comments.


comments

comment #1
Gravatar: cweiske cweiske May 29, 2013 14:02
There is no need to put that code snippets in a gist, since that might be gone next year. You don't use its syntax highlighting feature anyway.

comment #2
Gravatar: David Greiner David Greiner June 4, 2013 08:17
Hi Anja and all others! Thanks for this GIST.

Btw: In TYPO3 CMS 6.1. I think we have to use

----
'config' => TYPO3CMSCoreUtilityExtensionManagementUtility::getFileFieldTCAConfig('images')
----

instead of


----
TYPO3CMSCoreUtilityExtensionManagerUtility::getFileFieldTCA('images')
----

KR, David.

comment #3
Gravatar: David Greiner David Greiner June 4, 2013 08:18
Oops, the backslashes are gone.

comment #4
Gravatar: Anja Leichsenring Anja Leichsenring June 10, 2013 08:08
Hi David, thanks for the hint. I updated the gist.

Sorry, comments are closed for this post.