Commit 7e057100 authored by spthiel's avatar spthiel Committed by Anja Leichsenring
Browse files

[FEATURE] Add `expandAll` option for renderType=selectCheckBox

The renderType `selectCheckbox` allows for grouping of items,
which are rendered as collapsed per default.

A new TCA setting now allows to define this behavior for all
groups at once. By adding the new setting `expandAll=true`,
all groups are initially expanded. If not set or set to FALSE
the current behvahiour remains and all groups are collapsed.

Releases: master
Resolves: #91859
Change-Id: I9db196a7bfa6b1399358afdc785814425a764e80
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/65081


Tested-by: Oliver Bartsch's avatarOliver Bartsch <bo@cedev.de>
Tested-by: default avatarTYPO3com <noreply@typo3.com>
Tested-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
Tested-by: Anja Leichsenring's avatarAnja Leichsenring <aleichsenring@ab-softlab.de>
Reviewed-by: Oliver Bartsch's avatarOliver Bartsch <bo@cedev.de>
Reviewed-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Anja Leichsenring's avatarAnja Leichsenring <aleichsenring@ab-softlab.de>
parent 80cedc5f
......@@ -221,7 +221,8 @@ class SelectCheckBoxElement extends AbstractFormElement
}
if (is_array($group['header'])) {
$html[] = '<div id="' . $groupIdCollapsible . '" class="panel-collapse collapse" role="tabpanel">';
$expandAll = (bool)($config['appearance']['expandAll'] ?? false) ? 'in' : '';
$html[] = '<div id="' . $groupIdCollapsible . '" class="panel-collapse collapse ' . $expandAll . '" role="tabpanel">';
}
$checkboxId = StringUtility::getUniqueId($groupId);
$title = htmlspecialchars($this->getLanguageService()->sL('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.toggleall'));
......
.. include:: ../../Includes.txt
===================================================================
Feature #91859: Allow SelectCheckBox groups to be initally expanded
===================================================================
See :issue:`91859`
Description
===========
A new TCA setting `expandAll` has been added to FormEngine type `select` with
renderType `selectCheckBox`. It allows to define the initial display behavior
for grouped checkboxes.
By adding the new setting :php:`'expandAll' => true`, all select groups are
initially expanded.
Please note, that the new setting is placed in :php:`['config']['appearance']`
and is not a top level configuration key. Therefore the full path is:
:php:`$GLOBALS['TCA'][$table]['columns'][$field]['config']['appearance']['expandAll']`
Example
=======
.. code-block:: php
'select_checkbox' => [
'label' => 'select_checkbox - expandAll',
'config' => [
'type' => 'select',
'renderType' => 'selectCheckBox',
'appearance' => [
'expandAll' => true
],
'items' => [
['group 1', '--div--'],
['check 1', 1],
['check 2', 2],
['check 3', 3],
['group 2', '--div--'],
['check 4', 4],
['check 5', 5]
]
]
]
Impact
======
It's now possible to initally expand all checkbox groups. Integrators can
therefore provide their editors with all the choices at once, without
having to open each select group individually. The possibility to close each
group remains unchanged for the editor.
.. index:: TCA
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment