[BUGFIX] Disambiguate labels in exclude fields list
authorFrancois Suter <francois@typo3.org>
Fri, 4 Nov 2011 12:54:26 +0000 (13:54 +0100)
committerFrancois Suter <francois@typo3.org>
Sat, 5 Nov 2011 20:58:23 +0000 (21:58 +0100)
When defining access lists for be_groups, all exclude fields are
listed for selection, ordered alphabetically per table and field
label. It may happen that some fields have the same label within
the same table. This causes confusion.

This patch adds the field's name next to its label to avoid
confusion.

Change-Id: I503c8a2e547c749a8bdcc19d70abe2d2471e6650
Fixes: #25236
Releases: 4.7, 4.6, 4.5
Reviewed-on: http://review.typo3.org/6543
Reviewed-by: Philipp Gampe
Tested-by: Philipp Gampe
Reviewed-by: Georg Ringer
Tested-by: Georg Ringer
Reviewed-by: Francois Suter
Tested-by: Francois Suter
t3lib/class.t3lib_tceforms.php

index 4234124..1b02645 100644 (file)
@@ -4578,19 +4578,22 @@ class t3lib_TCEforms {
                                        $descr = '';
 
                                        foreach ($theTypes as $theTypeArrays) {
-                                               list($theTable, $theField) = explode(':', $theTypeArrays[1]);
+                                               list($theTable, $theFullField) = explode(':', $theTypeArrays[1]);
+                                                       // If the field comes from a FlexForm, the syntax is more complex
+                                               $theFieldParts = explode(';', $theFullField);
+                                               $theField = array_pop($theFieldParts);
 
                                                        // Add help text
                                                $helpText = array();
                                                $GLOBALS['LANG']->loadSingleTableDescription($theTable);
-                                               $helpTextArray = $GLOBALS['TCA_DESCR'][$theTable]['columns'][$theField];
+                                               $helpTextArray = $GLOBALS['TCA_DESCR'][$theTable]['columns'][$theFullField];
                                                if (!empty($helpTextArray['description'])) {
                                                        $helpText['description'] = $helpTextArray['description'];
                                                }
 
                                                        // Item configuration:
                                                $items[] = array(
-                                                       rtrim($theTypeArrays[0], ':'),
+                                                       rtrim($theTypeArrays[0], ':') . ' (' . $theField . ')',
                                                        $theTypeArrays[1],
                                                        'empty-empty',
                                                        $helpText