Robert
Robert

Reputation: 592

Override TCA Field

I want to override the field 'building' of the tt_address extension. I tried this in my sitepackage

typo3conf/ext/sitepackage/Configuration/TCA/Overrides/tt_address.php



$GLOBALS = [
    'TCA' => [
        'tt_address' => [
            'columns' => [
                'building' => [
                    'exclude' => true,
                    'label' => 'LLL:EXT:tt_address/Resources/Private/Language/locallang_db.xlf:tt_address.building',
                    'config' => [
                        'type' => 'select',
                        'renderType' => 'selectSingle',
                        'items' => [
                            ['Building 1', 0],
                            ['Building 2', 1],
                            ['Building 3', 2],
                        ],
                        'size' => 1,
                        'maxitems' => 4,
                        'eval' => ''
                    ],
                ],
            ],
        ],
    ],
];

Now I get the error: Given select field item list was not found.

Upvotes: 0

Views: 215

Answers (1)

Jo Hasenau
Jo Hasenau

Reputation: 2684

$GLOBALS = [

does not seem to be a good idea, since it will override the GLOBALS array completely.

It should be

$GLOBALS['TCA']['tt_address']['columns']['building'] = [
    'exclude' => true,
    'label' => 'LLL:EXT:tt_address/Resources/Private/Language/locallang_db.xlf:tt_address.building',
    'config' => [
        'type' => 'select',
        'renderType' => 'selectSingle',
        'items' => [
             ['Building 1', 0],
             ['Building 2', 1],
             ['Building 3', 2],
         ],
         'size' => 1,
         'maxitems' => 4,
         'eval' => ''
    ]
]

Upvotes: 3

Related Questions