[BUGFIX] "Allowed excludefields" misses non-tt_content FlexForms
authorKai Vogel <kai.vogel@speedprogs.de>
Mon, 9 Jan 2012 20:56:27 +0000 (21:56 +0100)
committerJigal van Hemert <jigal@xs4all.nl>
Wed, 7 Mar 2012 09:19:21 +0000 (10:19 +0100)
Extend the "Allowed excludefields" in group access lists to also show
FlexForm fields from other tables than tt_content.

Change-Id: Ie0fede48b9b85a60e89e7c6e768ee5b56d19e66f
Fixes: #31831
Releases: 4.7, 4.6, 4.5
Reviewed-on: http://review.typo3.org/7712
Reviewed-by: RĂ¼diger Marwein
Tested-by: RĂ¼diger Marwein
Reviewed-by: Jigal van Hemert
Tested-by: Jigal van Hemert
t3lib/class.t3lib_befunc.php

index 97e69e7..186d221 100644 (file)
@@ -482,50 +482,49 @@ final class t3lib_BEfunc {
         * @return      array           Array of arrays with excludeFields (fieldname, table:fieldname) from all TCA entries and from FlexForms (fieldname, table:extkey;sheetname;fieldname)
         */
        public static function getExcludeFields() {
-                       // All TCA keys:
-               $theExcludeArray = Array();
+                       // All TCA keys
+               $theExcludeArray = array();
                $tc_keys = array_keys($GLOBALS['TCA']);
                foreach ($tc_keys as $table) {
                                // Load table
                        t3lib_div::loadTCA($table);
-                               // All field names configured:
+                               // All field names configured
                        if (is_array($GLOBALS['TCA'][$table]['columns'])) {
                                $f_keys = array_keys($GLOBALS['TCA'][$table]['columns']);
                                foreach ($f_keys as $field) {
                                        if ($GLOBALS['TCA'][$table]['columns'][$field]['exclude']) {
-                                                       // Get Human Readable names of fields and table:
+                                                       // Get human readable names of fields and table
                                                $Fname = $GLOBALS['LANG']->sl($GLOBALS['TCA'][$table]['ctrl']['title']) . ': ' . $GLOBALS['LANG']->sl($GLOBALS['TCA'][$table]['columns'][$field]['label']);
-                                                       // add entry:
-                                               $theExcludeArray[] = Array($Fname, $table . ':' . $field);
+                                                       // Add entry
+                                               $theExcludeArray[] = array($Fname, $table . ':' . $field);
                                        }
                                }
                        }
-               }
                        // All FlexForm fields
-               $table = (!empty($GLOBALS['TYPO3_CONF_VARS']['SYS']['contentTable']) ? $GLOBALS['TYPO3_CONF_VARS']['SYS']['contentTable'] : 'tt_content');
-               $flexFormArray = self::getRegisteredFlexForms($table);
-               foreach ($flexFormArray as $tableField => $flexForms) {
-                               // Prefix for field label, e.g. "Plugin Options:"
-                       $labelPrefix = '';
-                       if (!empty($GLOBALS['TCA'][$table]['columns'][$tableField]['label'])) {
-                               $labelPrefix = $GLOBALS['LANG']->sl($GLOBALS['TCA'][$table]['columns'][$tableField]['label']);
-                       }
-                               // Get all sheets and title
-                       foreach ($flexForms as $extIdent => $extConf) {
-                               $extTitle = $GLOBALS['LANG']->sl($extConf['title']);
-                                       // Get all fields in sheet
-                               foreach ($extConf['ds']['sheets'] as $sheetName => $sheet) {
-                                       if (empty($sheet['ROOT']['el']) || !is_array($sheet['ROOT']['el'])) {
-                                               continue;
-                                       }
-                                       foreach ($sheet['ROOT']['el'] as $fieldName => $field) {
-                                                       // Use only excludeable fields
-                                               if (empty($field['TCEforms']['exclude'])) {
+                       $flexFormArray = self::getRegisteredFlexForms($table);
+                       foreach ($flexFormArray as $tableField => $flexForms) {
+                                       // Prefix for field label, e.g. "Plugin Options:"
+                               $labelPrefix = '';
+                               if (!empty($GLOBALS['TCA'][$table]['columns'][$tableField]['label'])) {
+                                       $labelPrefix = $GLOBALS['LANG']->sl($GLOBALS['TCA'][$table]['columns'][$tableField]['label']);
+                               }
+                                       // Get all sheets and title
+                               foreach ($flexForms as $extIdent => $extConf) {
+                                       $extTitle = $GLOBALS['LANG']->sl($extConf['title']);
+                                               // Get all fields in sheet
+                                       foreach ($extConf['ds']['sheets'] as $sheetName => $sheet) {
+                                               if (empty($sheet['ROOT']['el']) || !is_array($sheet['ROOT']['el'])) {
                                                        continue;
                                                }
-                                               $fieldLabel = (!empty($field['TCEforms']['label']) ? $GLOBALS['LANG']->sl($field['TCEforms']['label']) : $fieldName);
-                                               $fieldIdent = $table . ':' . $tableField . ';' . $extIdent . ';' . $sheetName . ';' . $fieldName;
-                                               $theExcludeArray[] = array(trim($labelPrefix . ' ' . $extTitle, ': ') . ': ' . $fieldLabel, $fieldIdent);
+                                               foreach ($sheet['ROOT']['el'] as $fieldName => $field) {
+                                                               // Use only excludeable fields
+                                                       if (empty($field['TCEforms']['exclude'])) {
+                                                               continue;
+                                                       }
+                                                       $fieldLabel = (!empty($field['TCEforms']['label']) ? $GLOBALS['LANG']->sl($field['TCEforms']['label']) : $fieldName);
+                                                       $fieldIdent = $table . ':' . $tableField . ';' . $extIdent . ';' . $sheetName . ';' . $fieldName;
+                                                       $theExcludeArray[] = array(trim($labelPrefix . ' ' . $extTitle, ': ') . ': ' . $fieldLabel, $fieldIdent);
+                                               }
                                        }
                                }
                        }