如何在页面模块列表视图中添加图标到自己的ctype

yog*_*ogi 1 typo3 typo3-7.6.x

在 TYPO3 7.6 中,我使用新的 CType 创建了一个新的内容元素。

我从图标工厂(内容引用)中选择了一个图标。

我设法将此图标包含到新元素向导中

mod.wizards.newContentElement.wizardItems.common.elements.myOwnCtype.iconIdentifier = content-quote
Run Code Online (Sandbox Code Playgroud)

在编辑内容元素时,我设法将图标包含到下拉字段“类型”中

$GLOBALS['TCA']['tt_content']['columns']['CType']['config']['items'][]
Run Code Online (Sandbox Code Playgroud)

但必须有第三个地方来定义ctypes的图标:

当我打开网页->页面时,我可以预览该页面上的所有内容元素。

每个内容元素的顶部都有一个灰色条,左上角有一个与其 ctype 相对应的图标。在我的例子中,这仍然显示标准图标。

我怎样才能改变这一点?

小智 5

您可以将此代码放在 EXT:my_extension/Configuration/TCA/Overrides/tt_content.php 中,以便在后端预览的标题中为您自己的 CType 设置图标。

$originalTtContent = $GLOBALS['TCA']['tt_content'];
$overridesForTtContent = [
  'ctrl' => [
    'typeicon_classes' => [
        'your_CType' => 'your_icon',
        'your_CType' => 'your_icon',
        'your_CType' => 'your_icon',
    ]
  ]
];
$GLOBALS['TCA']['tt_content'] = array_merge_recursive($originalTtContent, $overridesForTtContent);
Run Code Online (Sandbox Code Playgroud)