您可以为 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']);
}
}
}