首页 > 解决方案 > TYPO3 10.4.20 和 b13/容器

问题描述

我在typo3 10.4.20 composer 安装上安装了 b13/container 扩展。我想用容器替换网格元素。根据文档,您可以通过对 TCA Registry 进行 PHP 调用来注册新的内容元素。但是在执行完所有步骤后,它不会将“容器”选项卡添加到新内容元素向导中。

这是我的 tt_content.php

<?php
    
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTcaSelectItem(
    'tt_content',
    'CType',
     [
         'Great',
         'examples_newcontentelement',
         'content-text',
     ],
     'textmedia',
     'after'
 );

// Configure the default backend fields for the content element
$GLOBALS['TCA']['tt_content']['types']['eftmg_categorizedpages'] = [
    'showitem' => '
                --div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:general,
                    --palette--;;general,
                    --palette--;;headers,
                    selected_categories,
                    category_field,
                --div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.appearance,
                    --palette--;;frames,
                    --palette--;;appearanceLinks,
                --div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.accessibility,
                    --palette--;;menu_accessibility,
                --div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:language,
                    --palette--;;language,
                --div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:access,
                    --palette--;;hidden,
                    --palette--;;access,
                --div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:categories,
                    categories,
                --div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:notes,
                    rowDescription,
                --div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:extended,
            ',
    'columnsOverrides' => [
        'selected_categories' => [
            'config' => [
                'minitems' => 1,
            ]
        ],
        'category_field' => [
            'config' => [
                'itemsProcConfig' => [
                    'table' => 'pages'
                ]
            ]
        ]
    ]
];

// Configure containers
\TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\B13\Container\Tca\Registry::class)->configureContainer(
    (
        new \B13\Container\Tca\ContainerConfiguration(
            'b13-3col-container', // CType
            '3 Columns', // label
            'Some Description of the Container', // description
            [
                [
                    ['name' => 'left', 'colPos' => 200],
                    ['name' => 'middle', 'colPos' => 201],
                    ['name' => 'right', 'colPos' => 202]
                ]
            ] // grid configuration
        )
    )
     ->setIcon('EXT:tourismus/Resources/Public/Icons/b13-3col-container.svg')
);

也许我必须将我的版本降级到 TYPO3 10.4.18?

标签: typo3typo3-extensionstypo3-10.x

解决方案


您可以查看https://github.com/b13/container-example,它提供了一个带有 2 列的示例容器,使用 TCA 将其添加到 NewContentElement-Wizard 中。

我也在 10.4.20 上运行,它工作正常,可能是容器的 TCA .. 没有测试它,但你应该好好看看上面提到的例子。


推荐阅读