[TYPO3-english] TYPO3 6.0 FAL in FlexForm - no storing of sys_file_reference uid

Viktor Livakivskyi invisible.kinder at gmail.com
Thu Nov 28 18:41:46 CET 2013

Hi, List.

I'm using FAL in FlexForm and wnat to ensure, that I'm doing it right.

1. Flexform element <settings.image> must NOT contain <foreign_field>uid_foreign</foreign_field> - this will make TCE to store uid of sys_file_reference instead of number of relations to sys_file_reference.
Something, like this:
 <field index="settings.image">
       <value index="vDEF">1085</value>

2. If I want editor to define "alt"-text for an image, entered in sys_file_reference record, to be shown on website, I must do following in my controller:
/** @var \TYPO3\CMS\Core\Resource\ResourceFactory $resourceFactory */
$resourceFactory = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Resource\\ResourceFactory');
$fileReference = $resourceFactory->getFileReferenceObject($this->settings['test']);
$file = $fileReference->getProperties();
$this->view->assign('image', $file);

And then do something, like this in view:
<f:image src="{image.uid}" treatIdAsReference="TRUE" alt="{image.title}" maxWidth="200" />

Am I right here?

TYPO3 6.0.10

More information about the TYPO3-english mailing list