You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

TYPO3重写tt_address扩展building字段时遇「Given select field item list was not found」错误

解决TYPO3 tt_address building字段重写的「Given select field item list was not found」错误

问题根源

你的代码直接重新赋值了整个$GLOBALS数组,这会覆盖TYPO3原本的TCA全局配置,导致系统丢失了select字段正常工作所需的底层依赖配置,从而触发该错误。

正确的TCA覆盖方式

不要重新定义整个$GLOBALS,而是直接修改$GLOBALS['TCA']['tt_address']['columns']['building']的配置:

<?php
defined('TYPO3') or die();

$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' => ''
    ],
];

额外注意事项

  • 确保文件顶部添加defined('TYPO3') or die();安全校验,防止直接访问文件。
  • 修改TCA后,必须清除TYPO3的系统缓存(包括配置缓存)才能让修改生效。
  • 如果需要保留原字段的部分配置(比如l10n_mode等),可以使用数组合并的方式:
    $GLOBALS['TCA']['tt_address']['columns']['building']['config'] = array_replace_recursive(
        $GLOBALS['TCA']['tt_address']['columns']['building']['config'],
        [
            'type' => 'select',
            'renderType' => 'selectSingle',
            'items' => [
                ['Building 1', 0],
                ['Building 2', 1],
                ['Building 3', 2],
            ],
            'size' => 1,
            'maxitems' => 4,
        ]
    );
    

内容的提问来源于stack exchange,提问作者Robert

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.20 06:30:51