如何在TYPO3后端布局中的名称后面显示colpos id?

问题描述 投票:0回答:1

我需要在生产网站上为常规编辑显示 tt_content 记录的 colpos id,目前它仅显示在我的开发空间网站中。

您知道如何添加它吗? 谢谢!

typo3 tca
1个回答
0
投票

您可以为 itemsProcFunc

 字段添加自定义 
select
,该字段用于此处的 
colPos
列。使用 TCA overrides 相应地注册它:

\TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule(
    original: $GLOBALS['TCA']['tt_content'],
    overrule: [
        'columns' => [
            'colPos' => [
                'config' => [
                    'itemsProcFunc' => \VENDOR\Extension\UserFunction\FormEngine\ItemProcessor::class . '->appendValueToLabel',
                ],
            ],
        ],
    ],
);

ItemProcessor
班:

<?php
declare(strict_types = 1);

namespace VENDOR\Extension\UserFunction\FormEngine;

final class ItemProcessor
{
    public function appendValueToLabel(array &$params): void
    {
        foreach ($params['items'] as &$item) {
            $item['label'] = sprintf('%s [%s]', $item['label'], $item['value']);
        }
    }
}
© www.soinside.com 2019 - 2024. All rights reserved.