[BUGFIX] Categories as exclude field 73/27373/4
authorFrancois Suter <francois@typo3.org>
Thu, 23 Jan 2014 12:29:34 +0000 (13:29 +0100)
committerFrancois Suter <francois@typo3.org>
Wed, 19 Feb 2014 16:05:26 +0000 (17:05 +0100)
When a table is marked as being categorizable, the
categories field is added with an "exclude" flag
hard-coded to 0. Thus it is not possible to hide
this field for editors.

This patch changes the default value to 1 and makes
overridable.

Resolves: #53454
Documentation: #55718
Releases: 6.2
Change-Id: Iff2431b4294b8d3b9cf3dff291186e1a6a2ebafb
Reviewed-on: https://review.typo3.org/27373
Reviewed-by: Wouter Wolters
Tested-by: Wouter Wolters
Reviewed-by: Markus Klein
Tested-by: Markus Klein
Reviewed-by: Francois Suter
Tested-by: Francois Suter
NEWS.md
typo3/sysext/core/Classes/Category/CategoryRegistry.php

diff --git a/NEWS.md b/NEWS.md
index 4347027..61e9590 100644 (file)
--- a/NEWS.md
+++ b/NEWS.md
@@ -210,3 +210,8 @@ Pages and content elements are now categorizable by default.
 
 The "Special Menus" content element type now offers the possibility to display
 a list of categorized pages or content elements.
+
+* Category fields are excluded by default
+
+Category fields are created as exclude field (TCA) by default.
+If you're upgrading don't forget to add the permission for users.
index 2ea70ae..5dd35b0 100644 (file)
@@ -348,6 +348,7 @@ class CategoryRegistry implements \TYPO3\CMS\Core\SingletonInterface {
                                ),
                        );
 
+                       // Merge changes to TCA configuration
                        if (!empty($options['fieldConfiguration'])) {
                                \TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule(
                                        $fieldConfiguration,
@@ -355,14 +356,21 @@ class CategoryRegistry implements \TYPO3\CMS\Core\SingletonInterface {
                                );
                        }
 
+                       // Take specific label into account
                        $label = 'LLL:EXT:lang/locallang_tca.xlf:sys_category.categories';
                        if (!empty($options['label'])) {
                                $label = $options['label'];
                        }
 
+                       // Take specific value of exclude flag into account
+                       $exclude = TRUE;
+                       if (isset($options['exclude'])) {
+                               $exclude = (bool)$options['exclude'];
+                       }
+
                        $columns = array(
                                $fieldName => array(
-                                       'exclude' => 0,
+                                       'exclude' => $exclude,
                                        'label' => $label,
                                        'config' => $fieldConfiguration,
                                ),