[FEATURE] Use FAL file extension filter in TCA
authorIngmar Schlecht <ingmar@typo3.org>
Thu, 17 May 2012 10:59:18 +0000 (12:59 +0200)
committerAndreas Wolf <andreas.wolf@ikt-werk.de>
Wed, 30 May 2012 19:58:52 +0000 (21:58 +0200)
Change-Id: Ib85a55deae6e0d11669da804660630dbd95d9115
Releases: 6.0
Resolves: #37251
Reviewed-on: http://review.typo3.org/11270
Reviewed-by: Tolleiv Nietsch
Tested-by: Tolleiv Nietsch
Reviewed-by: Andreas Wolf
Tested-by: Andreas Wolf
t3lib/class.t3lib_extmgm.php
typo3/sysext/cms/tbl_tt_content.php

index f456c94..69fe629 100644 (file)
@@ -515,9 +515,10 @@ final class t3lib_extMgm {
         *
         * @param string $fieldName Name of the field to be used
         * @param array $customSettingOverride Custom field settings overriding the basics
+        * @param string $allowedFileExtensions Comma list of allowed file extensions (e.g. "jpg,gif,pdf")
         * @return array
         */
-       public static function getFileFieldTCAConfig($fieldName, array $customSettingOverride = array()) {
+       public static function getFileFieldTCAConfig($fieldName, array $customSettingOverride = array(), $allowedFileExtensions = '', $disallowedFileExtensions = '') {
                $fileFieldTCAConfig = array(
                        'type' => 'inline',
                        'foreign_table' => 'sys_file_reference',
@@ -529,6 +530,23 @@ final class t3lib_extMgm {
                        ),
                        'foreign_label' => 'uid_local',
                        'foreign_selector' => 'uid_local',
+                       'foreign_selector_fieldTcaOverride' => array(
+                               'config' => array(
+                                       'appearance' => array(
+                                               'elementBrowserType' => 'file',
+                                               'elementBrowserAllowed' => $allowedFileExtensions,
+                                       ),
+                               ),
+                       ),
+                       'filter' => array(
+                               array(
+                                       'userFunc' => 't3lib_file_Utility_FileExtensionFilter->filterInlineChildren',
+                                       'parameters' => array(
+                                               'allowedFileExtensions' => $allowedFileExtensions,
+                                               'disallowedFileExtensions' => $disallowedFileExtensions,
+                                       ),
+                               ),
+                       ),
                        'appearance' => array(
                                'useSortable' => TRUE,
                                'headerThumbnail' => 'uid_local',
index ec5d85f..7b626a5 100755 (executable)
@@ -719,7 +719,7 @@ $TCA['tt_content'] = array(
                                                        --palette--;;filePalette',
                                        ),
                                ),
-                       )),
+                       ), $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext']),
                ),
                'imagewidth' => array(
                        'exclude' => 1,