New Checkbox Feature for TYPO3 v10

David Steeb

At b13, we have been working with TYPO3 for more than 15 years now. TYPO3 is getting a lot of love (again) and people are praising its features, look-and-feel, ease-of-use, and speed—to name a few things—but we still get complaints from content editors. “The choice of options is overwhelming.” … “I don’t know when to switch between ‘Page’ and ‘List.’” … “I just want to add a page, why do I have to fill out a gazillion form fields?”

If we’re honest, lots of these complaints can be attributed to integrator-laziness when setting up these sites. If you take the time to clean up your backend before inviting editors to log in, you’ll avoid most of these issues in the first place. Since back in the days when the backend was yellow-ish, the TYPO3 community (and interface!) have come a long way. Lots of defaults have been set with an editor-friendly experience in mind. Long gone are the days you had to check a box for TYPO3 *not* to do something :-)

But even in a polished backend, only showing the form fields really in use and needed at any given time in the editorial process, editors are faced with decisions they are unable or unwilling to make. Just a few examples from frustrated editors in our digital suggestion box: 

Why should I decide to include this page in the search? Shouldn’t that work out-of-the-box? I mean, not everyone searches for the same thing, so why should I decide to add my page to the search results?
—  G.M., Customer Success Specialist
I don’t understand why anyone would exclude anything from indexing ever. Why can’t editors just leave these checkboxes and settings untouched?
—  P.B., Website Performance Analyst
I’m new to this whole online editing thing. Why does this TYPO10 force me to decide things I don’t know? I miss the old days of just writing my opinion column in WordPerfect—it was so, so much easier.
—  M.P., Very Senior Editor

New TCA field renderType “checkboxThreeturn” for TYPO3 v10.4 LTS

As you all know lots of people have been working very hard to finalize the next major version of TYPO3, due to be released in the coming weeks. TYPO3 v10.4 is the next LTS version (Long Term Support) and will be supported until 2023. Although version 10.3 officially was the “Feature Freeze” version, we managed to squeeze in an additional improvement that your editors are going to LOVE. Three-turn checkboxes to the rescue!

If you're not sure about a setting, just use the new “undecided” state!
If you're not sure about a setting, just use the new “undecided” state!

The TCA (Table Configuration Array) for checkbox-type field displays now offers a new renderType: checkboxThreeturn. With it, editors can choose to leave a checkbox-related question in an “unanswered state,” so to speak … yes, no, I don’t know!

Here’s how you can implement this new feature:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
'checkbox_b13' => [
'exclude' => 1,
'label' => 'checkbox_b13 single checkbox including an undecided option',
'config' => [
'type' => 'check',
'renderType' => 'checkboxThreeturn',
'items' => [
[
0 => '',
1 => '',
],
],
],
],

The default value for the “undecided” option is “NULL”; you might have to adjust your SQL accordingly. It is also possible to add a specific value to the “undecided” state, like this:

1
2
3
4
5
6
7
        'items' =>
[
0 => '',
1 => '',
]
],
'undecidedDBValue' => 'whatever',

Of course, you can use all other TCA features as explained in the TCA reference, like adding a description, so editors can make informed choices (or an informed no choice at all):

1
2
3
4
5
6
7
8
9
'checkbox_b13' => [
'exclude' => 1,
'label' => 'checkbox_b13 single checkbox including an undecided option',
'description' => 'It is important to know that you are not *forced* to make
a decision here. If you are unsure what to do, don\'t feel like making a
decision right now, or not up for sharing your opinion with other editors
for now, just leave this field untouched.'
,
'config' => [
...

“I’m on 10.4-dev and just can’t seem to get this working”

So the eager developer in you wanted to see this nifty feature in action, but it didn’t work? As you can surely understand, there are technical implications that could affect your production instances if this behavior were enabled by default at such a late point in the release cycle, just days before the final release of TYPO3 v10.4. So, this feature must be explicitly activated to make it available.

TYPO3 introduced “Feature Toggles” in version 9.4 that can be used to include possibly-breaking behavior (in TYPO3 core) in a non-destructive way. These feature toggles are part of the Admin Tools and are located under the “Settings” tab if you have system-maintainer access permissions:

Enable the new Three Turn Checkbox feature using the Install Tool
Enable the new Three Turn Checkbox feature using the Install Tool

If you’re working with version control (and you should be!), you will see that these Feature Toggle settings are added to your LocalConfiguration.php:

1
2
3
4
5
6
7
8
9
10
'SYS' => [
'features' => [
'TypoScript.strictSyntax' => false,
'checkboxThreeturnAprilFoolsDay' => true,
'fluidBasedPageModule' => false,
'redirects.hitCount' => false,
'simplifiedControllerActionDispatching' => false,
'unifiedPageTranslationHandling' => true,
],
],
LocalConfiguration.php

Open Source moves at a rapid pace

This feature is another example of the great things you can do with an Open Source Project like TYPO3: fix it, make it better, extend it to meet real-world needs (and undecided content editors!). We love that the system we use every day is so flexible. TYPO3 development moves fast, adding helpful features, polishing the editor experience, and refining things that have been there for years—all thanks to the vibrant developer community we are proud to be a part of.

We contribute a lot to TYPO3, especially to the core. If you or your editors need something fixed or improved in the system, we’re in a unique position to help you. Ask us about that bug you hate or about adding that feature you desperately need to your TYPO3 instance (as a custom extension) or to the TYPO3 core.

Read more about our TYPO3 CMS services here.