From cb391733c4b4c066db60b3f91711adb761ea37f5 Mon Sep 17 00:00:00 2001
From: Mathias Schreiber <mathias.schreiber@wmdb.de>
Date: Thu, 29 Oct 2015 12:48:32 +0100
Subject: [PATCH] [BUGFIX] Collapse excludefield lists by default

In order to make the exclude field lists shorter and easier to manage,
we collapse checkbox groups with headers.

Resolves: #71122
Releases: master
Change-Id: I5b3cf30619f69b6592efbf926e529b3e9eb1e1a7
Reviewed-on: https://review.typo3.org/44349
Reviewed-by: Morton Jonuschat <m.jonuschat@mojocode.de>
Tested-by: Morton Jonuschat <m.jonuschat@mojocode.de>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Benjamin Kott <info@bk2k.info>
Tested-by: Benjamin Kott <info@bk2k.info>
---
 .../Classes/Form/Element/SelectCheckBoxElement.php     | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/typo3/sysext/backend/Classes/Form/Element/SelectCheckBoxElement.php b/typo3/sysext/backend/Classes/Form/Element/SelectCheckBoxElement.php
index 459605877581..977332b59267 100644
--- a/typo3/sysext/backend/Classes/Form/Element/SelectCheckBoxElement.php
+++ b/typo3/sysext/backend/Classes/Form/Element/SelectCheckBoxElement.php
@@ -142,7 +142,7 @@ class SelectCheckBoxElement extends AbstractFormElement
                 $html[] = '<div class="panel panel-default">';
                 if (is_array($group['header'])) {
                     $html[] = '<div class="panel-heading">';
-                    $html[] = '<a data-toggle="collapse" href="#' . $groupId . '" aria-expanded="true" aria-controls="' . $groupId . '">';
+                    $html[] = '<a data-toggle="collapse" href="#' . $groupId . '" aria-expanded="false" aria-controls="' . $groupId . '">';
                     $html[] = $group['header']['icon'];
                     $html[] = $group['header']['title'];
                     $html[] = '</a>';
@@ -200,7 +200,9 @@ class SelectCheckBoxElement extends AbstractFormElement
                             . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:labels.revertSelection') . '</a>';
                     }
 
-                    $html[] = '<div id="' . $groupId . '" class="panel-collapse collapse in" role="tabpanel">';
+                    if (is_array($group['header'])) {
+                        $html[] = '<div id="' . $groupId . '" class="panel-collapse collapse" role="tabpanel">';
+                    }
                     $html[] =    '<div class="table-fit">';
                     $html[] =        '<table class="table table-transparent table-hover">';
                     $html[] =            '<thead>';
@@ -213,7 +215,9 @@ class SelectCheckBoxElement extends AbstractFormElement
                     $html[] =            '<tbody>' . implode(LF, $tableRows) . '</tbody>';
                     $html[] =        '</table>';
                     $html[] =    '</div>';
-                    $html[] = '</div>';
+                    if (is_array($group['header'])) {
+                        $html[] = '</div>';
+                    }
                 }
                 $html[] = '</div>';
             }
-- 
GitLab