Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/typo3/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Typo3 TCA外部\u表如何为select:选项选择标签_Typo3 - Fatal编程技术网

Typo3 TCA外部\u表如何为select:选项选择标签

Typo3 TCA外部\u表如何为select:选项选择标签,typo3,Typo3,应该是可能的,请参阅我想用作标签的目标实体中的哪个字段。但是在文档中找不到这个 例如-默认情况下,我在selectbox:option中获取 $temporaryColumns = array( 'my_related_item' => array( 'label' => 'Related s', 'l10n_mode' => 'mergeIfNotBlank', 'config' => [

应该是可能的,请参阅我想用作标签的目标实体中的哪个字段。但是在文档中找不到这个

例如-默认情况下,我在selectbox:option中获取

$temporaryColumns = array(
    'my_related_item' => array(
        'label' => 'Related s',
        'l10n_mode' => 'mergeIfNotBlank',
        'config' => [
            'type' => 'select',
            'renderType' => 'selectMultipleSideBySide',
            'items' => [
            ],
            'foreign_table' => 'tx_some_domain_model_item',
            'MM' => 'tx_some_domain_model_mm',
            'itemsProcFunc' => 'my\ext\TCA\SelectProcFunc->prepareItems',
            'enableMultiSelectFilterTextfield' => true,
            'size' => 10,
            'autoSizeMax' => 30,
            'maxitems' => 9999,
        ],
    ),
);
但我需要

{value = uid
label = title }
更新:

我发现要在seelctbox中获得定制标签我无法使用

{value = uid
label = clear_name}
因为这将改变列表全局-但我只需要在选择框中。所以我在TCA中尝试了其他解决方案

'itemsProcFunc'=>'TBF\TbfPackage\TCA\SelectProcFunc->prepareItems'

在SelectProcFunc.php中

'ctrl' => [
    'label' => 'clear_name',
], 

问题我的$param['items']为空-我发现了相同的问题。Bug或我做错了什么?

因为用于呈现可用项列表的外部表的。所以,如果您想要一个不同的字段,您需要更改该选项。

Thx,我尝试了像'label'=>“clear\u name”、'label'=>“clear\name”、“label'=“tx\u一些域模型项目。clear\u name”但没有效果看起来像ctrl->label全局设置对表有影响我需要在选择框中更改label,似乎我需要自定义itemsProcFunc方法,而不是在附加的外部表中
namespace my\ext\TCA;
/**
 * Description of SelectProcFunc
 *
 * @author Oleg Karun
 */
class SelectProcFunc  {

    public function prepareItems(&$param) {
        debug($param);

        $newItems = [];
        foreach ($param['items'] as $item) {
            $newItem = [
                0 => $item->getUid(),
                1 => $item->getClearName()
            ];
            $newItems[] = $newItem;
        }
        //$param['items'] = $newItems;
        return $param;
    }

}