如何在 typo3 EXT: gridelements 的内容元素向导中设置图标
How to set an Icon in the Content Element Wizard of typo3 EXT: gridelements
如何设置网格元素的图标(向导)
好像有一些变化,因为我以前做的方式已经不管用了。
我在文档中没有找到相关内容
typo3 版本 7.LTS / Gridelements 7.0.5
tx_gridelements {
overruleRecords = 1
setup {
TB_3col {
title = Drei Spalten einfach
description = (33-33-33; 50-25-25; 25-50-25; 25-25-50) (12er Grid)
topLevelLayout = 1
icon = EXT:myext/Resources/Public/Icon/grid.png
config {
colCount = 3
rowCount = 1
rows {
1 {
columns {
1 {
name = Spalte 1
colPos = 101
}
2 {
name = Spalte 2
colPos = 102
}
3 {
name = Spalte 3
colPos = 103
}
}
}
}
}
}
}
查看 Gridelements 问题跟踪器中的此线程以获取一些示例。 https://forge.typo3.org/issues/73198
您可以使用图标标识符或另一个图标文件的路径,但不能同时使用两者。
图标标识符只有在你正式使用核心的图标API方法注册图标时才能使用。
设置标识符将始终覆盖 iconFile 中的路径,因为注册图标是处理 TYPO3 中图标文件的推荐方式。
对于 Gridelements 本身,这是在 ext_tables.php
中完成的
$iconRegistry = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Imaging\IconRegistry::class);
$iconRegistry->registerIcon('gridelements-default', \TYPO3\CMS\Core\Imaging\IconProvider\SvgIconProvider::class, array(
'source' => 'EXT:gridelements/Resources/Public/Icons/gridelements.svg'
));
规则是:
您可以自己提供iconIdentifier和iconIdentifierLarge,但是您必须事先注册图标以及您在设置将被忽略。
如果您在设置中提供带有 icon 和 iconLarge 的图标文件,标识符会自动生成,因此您不应设置他们手动。
我刚刚找到了解决方案。 icon
切换为 iconIdentifier
tx_gridelements {
overruleRecords = 1
setup {
TB_2col {
title =Zwei Spalten einfach
description = (50-50; 66-33; 33-66; 75-25; 25-75) (12er Grid)
topLevelLayout = 1
iconIdentifier = default-icon
flexformDS = FILE:EXT:fred/Configuration/FlexForms/Grid/TB_2col.xml
config {
colCount = 2
rowCount = 1
rows {
1 {
columns {
1 {
name = Spalte 1
colPos = 101
}
2 {
name = Spalte 2
colPos = 102
}
}
}
}
}
}
}
添加图标 ext_tables.php
$iconRegistry = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
\TYPO3\CMS\Core\Imaging\IconRegistry::class
);
$iconRegistry->registerIcon(
'default-icon',
\TYPO3\CMS\Core\Imaging\IconProvider\BitmapIconProvider::class,
['source' => 'EXT:myext/Resources/Public/Images/CE/myicon.png']
);
如何设置网格元素的图标(向导)
好像有一些变化,因为我以前做的方式已经不管用了。
我在文档中没有找到相关内容
typo3 版本 7.LTS / Gridelements 7.0.5
tx_gridelements {
overruleRecords = 1
setup {
TB_3col {
title = Drei Spalten einfach
description = (33-33-33; 50-25-25; 25-50-25; 25-25-50) (12er Grid)
topLevelLayout = 1
icon = EXT:myext/Resources/Public/Icon/grid.png
config {
colCount = 3
rowCount = 1
rows {
1 {
columns {
1 {
name = Spalte 1
colPos = 101
}
2 {
name = Spalte 2
colPos = 102
}
3 {
name = Spalte 3
colPos = 103
}
}
}
}
}
}
}
查看 Gridelements 问题跟踪器中的此线程以获取一些示例。 https://forge.typo3.org/issues/73198
您可以使用图标标识符或另一个图标文件的路径,但不能同时使用两者。 图标标识符只有在你正式使用核心的图标API方法注册图标时才能使用。 设置标识符将始终覆盖 iconFile 中的路径,因为注册图标是处理 TYPO3 中图标文件的推荐方式。
对于 Gridelements 本身,这是在 ext_tables.php
中完成的$iconRegistry = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Imaging\IconRegistry::class);
$iconRegistry->registerIcon('gridelements-default', \TYPO3\CMS\Core\Imaging\IconProvider\SvgIconProvider::class, array(
'source' => 'EXT:gridelements/Resources/Public/Icons/gridelements.svg'
));
规则是:
您可以自己提供iconIdentifier和iconIdentifierLarge,但是您必须事先注册图标以及您在设置将被忽略。
如果您在设置中提供带有 icon 和 iconLarge 的图标文件,标识符会自动生成,因此您不应设置他们手动。
我刚刚找到了解决方案。 icon
切换为 iconIdentifier
tx_gridelements {
overruleRecords = 1
setup {
TB_2col {
title =Zwei Spalten einfach
description = (50-50; 66-33; 33-66; 75-25; 25-75) (12er Grid)
topLevelLayout = 1
iconIdentifier = default-icon
flexformDS = FILE:EXT:fred/Configuration/FlexForms/Grid/TB_2col.xml
config {
colCount = 2
rowCount = 1
rows {
1 {
columns {
1 {
name = Spalte 1
colPos = 101
}
2 {
name = Spalte 2
colPos = 102
}
}
}
}
}
}
}
添加图标 ext_tables.php
$iconRegistry = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
\TYPO3\CMS\Core\Imaging\IconRegistry::class
);
$iconRegistry->registerIcon(
'default-icon',
\TYPO3\CMS\Core\Imaging\IconProvider\BitmapIconProvider::class,
['source' => 'EXT:myext/Resources/Public/Images/CE/myicon.png']
);