Skip to content

Instantly share code, notes, and snippets.

@chriwo
Last active November 16, 2015 12:46
Show Gist options
  • Save chriwo/764ae0c0f3b0ce118b9b to your computer and use it in GitHub Desktop.
Save chriwo/764ae0c0f3b0ce118b9b to your computer and use it in GitHub Desktop.
Create a new FAL element in TCA. To use it, change the current field name "new_fal_image" and the table name "YOUR TABLE NAME", so that TYPO3 find your image
CREATE TABLE your_table_name (
new_fal_image int(11) DEFAULT '0' NOT NULL,
);
'columns' => array(
'new_fal_image' => array(
'exclude' => 1,
'l10n_mode' => 'mergeIfNotBlank',
'label' => 'FAL image label',
'config' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig(
'media',
array(
'appearance' => array(
'showPossibleLocalizationRecords' => 1,
'showRemovedLocalizationRecords' => 1,
'showAllLocalizationLink' => 1,
'showSynchronizationLink' => 1,
),
'foreign_match_fields' => array(
'fieldname' => 'new_fal_image',
'tablenames' => 'YOUR TABLE NAME',
'table_local' => 'sys_file',
),
// custom configuration for displaying fields in the overlay/reference table
// to use the newsPalette and imageoverlayPalette instead of the basicoverlayPalette
'foreign_types' => array(
'0' => array(
'showitem' => '
--palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imagePalette,
--palette--;;imageoverlayPalette,
--palette--;;filePalette',
),
\TYPO3\CMS\Core\Resource\File::FILETYPE_IMAGE => array(
'showitem' => '
--palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imagePalette,
--palette--;;imageoverlayPalette,
--palette--;;filePalette',
),
),
),
'jpg,jpeg,gif,png'
),
),
),
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment