插入特定的 tt_content 元素作为 irre ('type' => 'inline')

insert specific tt_content element as irre ('type' => 'inline')

我想插入一个新的特定内容元素作为内联元素。 外国 table 将是 tt_content.

如果这样做,我将获得所有选项(ctype 下拉列表等)

是否可以预先选择一个内容元素 (ctype) 并防止用户在内联编辑中更改它?

'children' => [
        'exclude' => 0,
        'label'   => 'LLL:Label',
        'config'  => [
            'type'          => 'inline',
            'foreign_table' => 'tt_content',
            'foreign_field' => 'parent'
        ]
    ],

不简单。

查看 ext:gridelments,其中插入了限制列中 CE 类型的可能性。

否则您可以预填充 page-/user-TSconfig 中的 CType 字段并使用 CSS 隐藏该字段。但是输入字段只是不可见,使用 firebug 之类的工具,编辑器可以使它们再次可见。 您无法从显示中删除该字段(在 TCA 字段列表中),因为根本不会设置该字段。

您可以像这样更改默认值,也许您也可以覆盖默认调色板

    'config' => array(
        'type' => 'inline',
        'foreign_table' => 'tt_content',
        'foreign_field' => 'irre_multitab',
        'foreign_record_defaults' => array(
            'colPos' => '666',
            'CType' => 'text'
        ),
        'foreign_types' => array(
            'header' => array(
                'showitem' => '
                --palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.general;general,
                 '
            ),
        ),

TYPO3 v8.7+

的更新答案

foreign_record_defaults 的用法自 v8.7 起已弃用,建议使用 overrideChildTca,这提供了更多的覆盖机会。上面的例子看起来像这样:

'children' => [
    'exclude' => 0,
    'label'   => 'LLL:Label',
    'config'  => [
        'type' => 'inline',
        'foreign_table' => 'tt_content',
        'foreign_field' => 'parent',
        'overrideChildTca' => [
            // overwrite whichever children TCA configuration here
        ],
    ]
]