How to show the colpos id after the name in TYPO3 Backend layout?

95 Views Asked by At

I have a need to show for tt_content records the id of the colpos for regular editors on the production website, for now it is only shown in my development space website. Column colPos with id in brackets

do you have an idea how to add it ? Thank you!

1

There are 1 best solutions below

5
On

You can add a custom itemsProcFunc for the select field which is used for the colPos column here. Use TCA overrides to register it accordingly:

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

The ItemProcessor class:

<?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']);
        }
    }
}