TCA 文件,复选框默认选中

nba*_*bar 2 typo3 tx-news typo3-7.6.x

我想在后端设置一个复选框默认选中。

showinpreview就我而言,它是文件中的字段/typo3conf/ext/news/Configuration/TCA/tx_news_domain_model_media.php

我把值改成default了1,但是没有效果:

'showinpreview' => [
            'exclude' => 1,
            'label' => $ll . 'tx_news_domain_model_media.showinpreview',
            'config' => [
                'type' => 'check',
                'default' => 1
            ]
        ],
Run Code Online (Sandbox Code Playgroud)

当我检查 tt_content 的 TCA 文件中是否有选中的复选框时,它看起来像这样:

'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'
            ]
        ]
    ]
],
Run Code Online (Sandbox Code Playgroud)

我看到的唯一区别是items. 但我不太明白这个 item-value 的作用。

小智 5

更改此值的最简单方法是使用某些 pageTS 覆盖 TCA。将以下内容添加到保存新闻记录的文件夹的页面中。

TCAdefaults.sys_file_reference.showinpreview = 1

请参阅https://docs.typo3.org/typo3cms/TSconfigReference/PageTsconfig/TCEform/Index.html

对于较旧的 EXT:news 版本,请使用:TCAdefaults.tx_news_domain_model_media.showinpreview = 1