Created
December 14, 2012 10:52
-
-
Save anonymous/4284545 to your computer and use it in GitHub Desktop.
Test setup to use FAL file reference in extbase model
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TCA (this is the Definition for an image field using FAL reference): | |
'image' => array( | |
'exclude' => 0, | |
'label' => 'LLL:EXT:abs_content_elements/Resources/Private/Language/locallang_db.xlf:tx_abscontentelements_domain_model_box.image', | |
'config' => array( | |
'maxitems' => 1, | |
'type' => 'inline', | |
'foreign_table' => 'sys_file_reference', | |
'foreign_field' => 'uid_foreign', | |
'foreign_sortby' => 'sorting_foreign', | |
'foreign_table_field' => 'tablenames', | |
'foreign_match_fields' => array( | |
'fieldname' => 'image' | |
), | |
'foreign_label' => 'uid_local', | |
'foreign_selector' => 'uid_local', | |
'foreign_selector_fieldTcaOverride' => array( | |
'config' => array( | |
'appearance' => array( | |
'elementBrowserType' => 'file', | |
'elementBrowserAllowed' => $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'] | |
) | |
) | |
), | |
'filter' => array( | |
array( | |
'userFunc' => 'TYPO3\\CMS\\Core\\Resource\\Filter\\FileExtensionFilter->filterInlineChildren', | |
'parameters' => array( | |
'allowedFileExtensions' => $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'], | |
'disallowedFileExtensions' => '' | |
) | |
) | |
), | |
'appearance' => array( | |
'createNewRelationLinkTitle' => 'LLL:EXT:cms/locallang_ttc.xlf:images.addFileReference', | |
'useSortable' => TRUE, | |
'headerThumbnail' => array( | |
'field' => 'uid_local', | |
'width' => '64', | |
'height' => '64', | |
), | |
'showPossibleLocalizationRecords' => TRUE, | |
'showRemovedLocalizationRecords' => TRUE, | |
'showSynchronizationLink' => TRUE, | |
'enabledControls' => array( | |
'info' => FALSE, | |
'new' => FALSE, | |
'dragdrop' => TRUE, | |
'sort' => FALSE, | |
'hide' => TRUE, | |
'delete' => TRUE, | |
'localize' => TRUE, | |
), | |
), | |
'behaviour' => array( | |
'localizationMode' => 'select', | |
'localizeChildrenAtParentLocalization' => TRUE, | |
), | |
), | |
), | |
Model: | |
/** | |
* image | |
* | |
* @var \TYPO3\CMS\Extbase\Domain\Model\FileReference | |
*/ | |
protected $image; | |
/** | |
* sets the Image | |
* | |
* @param \TYPO3\CMS\Extbase\Domain\Model\FileReference $image | |
* | |
* @return void | |
*/ | |
public function setImage($image) { | |
$this->image = $image; | |
} | |
/** | |
* get the Image | |
* | |
* @return \TYPO3\CMS\Extbase\Domain\Model\FileReference | |
*/ | |
public function getImage() { | |
return $this->image; | |
} | |
Fluid Template: | |
<f:image src="{box.image.uid}" alt="{box.headline}" treatIdAsReference="TRUE"/> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment