[FEATURE] Integrate TCA helper for FAL aware fields
authorTYPO3 FAL Team <typo3v4@typo3.org>
Fri, 20 Apr 2012 15:52:56 +0000 (17:52 +0200)
committerOliver Hader <oliver.hader@typo3.org>
Sat, 28 Apr 2012 12:13:18 +0000 (14:13 +0200)
Integrates a helper method to setup proper TCA for FAL fields.

Change-Id: I68b3026fe3264f6fbbe3e1502c53446af5627082
Resolves: #36384
Releases: 6.0
Reviewed-on: http://review.typo3.org/10652
Reviewed-by: Steffen Ritter
Tested-by: Steffen Ritter
Reviewed-by: Susanne Moog
Tested-by: Susanne Moog
Reviewed-by: Tolleiv Nietsch
Tested-by: Tolleiv Nietsch
Reviewed-by: Oliver Hader
Tested-by: Oliver Hader
t3lib/class.t3lib_extmgm.php

index 624821a..d95e421 100644 (file)
@@ -511,6 +511,51 @@ final class t3lib_extMgm {
        }
 
        /**
+        * Gets the TCA configuration for a field handling (FAL) files.
+        *
+        * @param string $fieldName Name of the field to be used
+        * @param array $customSettingOverride Custom field settings overriding the basics
+        * @return array
+        */
+       public static function getFileFieldTCAConfig($fieldName, array $customSettingOverride = array()) {
+               $fileFieldTCAConfig = array(
+                       'type' => 'inline',
+                       'foreign_table' => 'sys_file_reference',
+                       'foreign_field' => 'uid_foreign',
+                       'foreign_sortby' => 'sorting_foreign',
+                       'foreign_table_field' => 'tablenames',
+                       'foreign_match_fields' => array(
+                               'fieldname' => $fieldName,
+                       ),
+                       'foreign_label' => 'uid_local',
+                       'foreign_selector' => 'uid_local',
+                       'foreign_selector_fieldTcaOverride' => array(
+                               'config' => array (
+                                       'filter' => array(
+                                               'fileType' =>  array(
+                                                       'allowed' => array(),
+                                               ),
+                                       ),
+                               ),
+                       ),
+                       'appearance' => array(
+                               'useSortable' => TRUE,
+                               'headerThumbnail' => 'uid_local',
+                               'enabledControls' => array(
+                                       'info' => FALSE,
+                                       'new' => FALSE,
+                                       'dragdrop' => TRUE,
+                                       'sort' => FALSE,
+                                       'hide' => TRUE,
+                                       'delete' => TRUE,
+                               ),
+                       ),
+               );
+
+               return t3lib_div::array_merge_recursive_overrule($fileFieldTCAConfig, $customSettingOverride);
+       }
+
+       /**
         * Adds a list of new fields to the TYPO3 USER SETTINGS configuration "showitem" list, the array with
         * the new fields itself needs to be added additionally to show up in the user setup, like
         * $GLOBALS['TYPO3_USER_SETTINGS']['columns'] += $tempColumns
@@ -1793,4 +1838,4 @@ $GLOBALS[\'TYPO3_LOADED_EXT\'] = unserialize(stripslashes(\'' . addslashes(seria
        }
 }
 
-?>
\ No newline at end of file
+?>