Toggle checkbox
The checkbox with the renderType checkboxToggle renders as one or several toggle switches. As opposed to the Labeled toggle checkbox no additional labels for the states can be defined.
A toggle
Its state can be inverted via invert.
Examples
Example: Single checkbox with toggle
A toggle
EXT:my_extension/Configuration/TCA/Overrides/115-tx_myextension_conference-published.php
<?php
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
defined('TYPO3') or die();
ExtensionManagementUtility::addTCAcolumns('tx_myextension_conference', [
'published' => [
'label' => 'my_extension.db:conference.published',
'exclude' => true,
'config' => [
'type' => 'check',
'renderType' => 'checkboxToggle',
],
],
]);
ExtensionManagementUtility::addToAllTCAtypes(
'tx_myextension_conference',
'published',
'',
'after:location',
);
checkbox: Instead of checkboxes, a toggle item is displayed.
Example: Single checkbox with toggle inverted state display
The field hidden that TYPO3 adds for ctrl > enablecolumns > disabled
'hidden' => [
'label' => 'core.db.general:enabled',
'exclude' => true,
'config' => [
'type' => 'check',
'renderType' => 'checkboxToggle',
'default' => 0,
'items' => [
[
'label' => '',
'invertStateDisplay' => true,
],
],
],
],
Copied!
inverted: A checkbox is marked checked if the database bit is
not set and vice versa.