invertStateDisplay

invertStateDisplay
Path

$GLOBALS['TCA'][$table]['columns'][$field]['config']

type

boolean

Scope

Display

Default

false

The state of a checkbox can be displayed inverted when this property is set to true.

Example

Toggle checkbox with invertStateDisplay

EXT:styleguide/Configuration/TCA/tx_styleguide_elements_basic.php
[
    'columns' => [
        'checkbox_18' => [
            'exclude' => 1,
            'label' => 'checkbox_18',
            'description' => 'renderType=checkboxToggle single inverted state display',
            'config' => [
                'type' => 'check',
                'renderType' => 'checkboxToggle',
                'items' => [
                    [
                        0 => 'foo',
                        'labelChecked' => 'Enabled',
                        'labelUnchecked' => 'Disabled',
                        'invertStateDisplay' => true,
                    ],
                ],
            ],
        ],
    ],
]
Copied!

Field hidden/visible in table tt_content

The field hidden is set to 1 if the record is hidden and to 0 if the record is visibile. However the field usually carries a label like Enabled. It is then displayed as "on", when the underlying field is set to 0. The following examples is from the core, table tt_content:

EXT:frontend/Configuration/TCA/tt_content.php
[
    'columns' => [
        'hidden' => [
            'exclude' => true,
            'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.visible',
            'config' => [
                'type' => 'check',
                'renderType' => 'checkboxToggle',
                'items' => [
                    [
                        0 => '',
                        'invertStateDisplay' => true,
                    ],
                ],
            ],
        ],
    ],
]
Copied!