Search code examples
typo3typo3-7.6.xtx-news

TCA file, checkbox default checked


I would like to set a checkbox in the backend to default checked.

In my case it is the field showinpreview in the file /typo3conf/ext/news/Configuration/TCA/tx_news_domain_model_media.php.

I changed the value default to 1, but it has no effect:

'showinpreview' => [
            'exclude' => 1,
            'label' => $ll . 'tx_news_domain_model_media.showinpreview',
            'config' => [
                'type' => 'check',
                'default' => 1
            ]
        ],

When I check the TCA File of tt_content for a checked checkbox it looks like this:

'sectionIndex' => [
    'exclude' => 1,
    'label' => 'LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:sectionIndex',
    'config' => [
        'type' => 'check',
        'default' => 1,
        'items' => [
            '1' => [
                '0' => 'LLL:EXT:lang/locallang_core.xlf:labels.enabled'
            ]
        ]
    ]
],

The only difference I see is the items. But I do not really understand what this item-value does.


Solution

  • The value of the field showinpreview is set in news/Configuration/TCA/Overrides/sys_file_reference.php. Apply your change there, and you will be happy.

    But be aware: after updating of the news extension your change will be lost.