的TYPO3擴展名必須是根據TYPO3 7.5和更高的要求進行修改。將myextkey替換爲擴展名的擴展名。
ext_localconf.php:
if (TYPO3_MODE == 'BE') {
$pageType = 'myext10'; // a maximum of 10 characters
$icons = array(
'apps-pagetree-folder-contains-' . $pageType => 'apps-pagetree-folder-contains-myextkey.svg'
);
/** @var \TYPO3\CMS\Core\Imaging\IconRegistry $iconRegistry */
$iconRegistry = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Imaging\IconRegistry::class);
foreach ($icons as $identifier => $filename) {
$iconRegistry->registerIcon(
$identifier,
$iconRegistry->detectIconProvider($filename),
array('source' => 'EXT:' . $_EXTKEY . '/Resources/Public/Icons/' . $filename)
);
}
}
配置/ TCA /覆蓋/ pages.php:
<?php
if (!defined ('TYPO3_MODE')) {
die ('Access denied.');
}
// add folder icon
$pageType = 'myext10'; // a maximum of 10 characters
$iconReference = 'apps-pagetree-folder-contains-' . $pageType;
$addToModuleSelection = TRUE;
foreach ($GLOBALS['TCA']['pages']['columns']['module']['config']['items'] as $item) {
if ($item['1'] == $pageType) {
$addToModuleSelection = false;
break;
}
}
if ($addToModuleSelection) {
$GLOBALS['TCA']['pages']['ctrl']['typeicon_classes']['contains-' . $pageType] = $iconReference;
$GLOBALS['TCA']['pages']['columns']['module']['config']['items'][] = array(
0 => 'LLL:EXT:myextkey/locallang.xml:pageModule.plugin',
1 => $pageType,
2 => $iconReference
);
}
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::registerPageTSConfigFile(
$pageType,
'Configuration/TSconfig/Page/folder_tables.txt',
'EXT:myextkey :: Restrict pages to myextkey records'
);
locallang.xml:
<label index="pageModule.plugin">My Extension: Table names of my extension</label>
個資源/公共/圖標/應用-pagetree文件夾,包含-myextkey.svg:爲您的分機表
看到https://github.com/TYPO3/TYPO3.Icons的工作例如SVG圖標 矢量圖形圖像文件。
配置/ TSconfig/Page/folder_tables.txt: 插入擴展名的表名。
mod.web_list.allowedNewTables = tx_myextkey_tablename1, tx_myextkey_tablename2, tx_myextkey_tablename3
很好,謝謝。還有一個關於來源的問題。由於我沒有擴展名,imags位於fileadmin文件夾中,我可以使用'/fileadmin/icons/application_side_list.png'嗎?因爲這似乎不起作用。 Pagetree顯示「/typo3/sysext/core/Resources/Public/Icons/T3Icons/default/default-not-found.svg」 – lufi
據我所知應該是'FILE:fileadmin/icons/...'。 – lorenz
這不起作用。它始終顯示「未找到」圖標。我已經嘗試了很多,這真的很令人沮喪。 – lufi