gpt4 book ai didi

typo3 - 如何在 TYPO3 扩展中设置内容元素或插件的图标

转载 作者:行者123 更新时间:2023-12-02 01:45:55 26 4
gpt4 key购买 nike

如何为内容元素和插件配置图标?有没有快捷方式可以只配置一次而不是在 3 个地方配置?

据我所知,在 TYPO3 后端中创建新的自定义内容元素和插件时,有 3 个位置可以配置图标:

  1. 新建内容元素向导
  2. 编辑内容元素 (CE) 时,CType/list_type 选择列表中可见的内容

enter image description here

  • 页面布局 View 中可见的内容
  • enter image description here

    最佳答案

    我不知道有什么捷径,这就是我的做法。

    首先,注册一个图标标识符来引用您的图标,请参阅官方 TYPO3 文档:Icon API > Registration .

    您可以注册例如 SVG 图标或 Font Awesome 图标。


    接下来,确保在这 3 个位置正确配置图标:

    <强>1。新内容元素 (CE) 向导

    在页面 TSconfig 中配置

    例如(使用之前注册的图标标识符)

    mod.wizards.newContentElement.wizardItems.common.show:=addToList(extkey_plugin)
    mod.wizards.newContentElement.wizardItems.common.elements.extkey_plugin {
    iconIdentifier = my-icon
    # ...
    }

    TYPO3 文档:Add content elements to the Content Element Wizard


    <强>2。 CType/list_type 选择列表:

    对于 Extbase 插件,这是通过 registerPlugin(参数 4)配置的

    配置/TCA/Overrides/tt_content.php:

    \TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin(
    'ExtkeyInCamelCase',
    'PluginIdentifier',
    'plugin title',
    // icon
    'my-icon');

    TYPO3 文档:Extbase Plugin registration

    对于非 Extbase 插件,可以通过 addPlugin 传递图标.

    对于内容元素,可以通过 TCA 配置:

    配置/TCA/Overrides/tt_content.php:

    \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTcaSelectItem(
    'tt_content',
    'CType',
    [
    'Title',
    // plugin signature: extkey_identifier
    'myext_plugin',
    // icon identifier
    'my-icon',

    TYPO3 文档:Register the content element


    <强>3。在页面布局 View 中:

    对于内容元素,可以在TCA中设置:

    配置/TCA/Overrides/tt_content.php:

    $GLOBALS['TCA']['tt_content']['ctrl']['typeicon_classes'][$pluginname] = 'my-icon';

    TYPO3 文档:typeicon_classes

    对于插件,页面布局 View 中的图标已通过 registerPlugins 自动注册(自 TYPO3 v11.5.12 起)。

    关于typo3 - 如何在 TYPO3 扩展中设置内容元素或插件的图标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70905320/

    26 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com