与您的向导类型相关,注册过程是不同的,并且在此处进行了广泛的解释。您可以保留 Routes.php 中的条目(如果里面没有其他内容,甚至可能是整个文件)。
注册在ext_localconf.php
:
$GLOBALS['TYPO3_CONF_VARS']['SYS']['formEngine']['nodeRegistry'][1485351217] = [
'nodeName' => 'importDataControl',
'priority' => 30,
'class' => \T3G\Something\FormEngine\FieldControl\ImportDataControl::class
];
然后在 TCA 中引用新向导:
'somefield' => [
'label' => $langFile . ':pages.somefield',
'config' => [
'type' => 'input',
'eval' => 'int, unique',
'fieldControl' => [
'importControl' => [
'renderType' => 'importDataControl'
]
]
]
],
然后终于有了“魔法”的班级
declare(strict_types=1);
namespace T3G\Something\FormEngine\FieldControl;
use TYPO3\CMS\Backend\Form\AbstractNode;
class ImportDataControl extends AbstractNode
{
public function render()
{
$result = [
'iconIdentifier' => 'import-data',
'title' => $GLOBALS['LANG']->sL('LLL:EXT:something/Resources/Private/Language/locallang_db.xlf:pages.importData'),
'linkAttributes' => [
'class' => 'importData ',
'data-id' => $this->data['databaseRow']['somefield']
],
'requireJsModules' => ['TYPO3/CMS/Something/ImportData'],
];
return $result;
}
}
在链接的示例中,仍然有一个带有相应文件的 Ajax 路由,包括一个特殊定义的路由,但这不是显示基本向导所必需的。
关于ext_localconf.php
那里的注册,上面显示了1485351217
数组键的数字。对于自己的注册节点,只需计算一次当前时间作为 unix-timestamp 并输入它。所以它是唯一的,不能与任何注册节点的其他定义混淆。
与链接的示例相比,我使用了稍微不同的描述,因此我在 ext_localconf.php 中调用了该过程registering
,并将其包含在 TCA 中referencing
。也许这个微小的差异使它更清楚一点。
图标
关于图标,与早期的 TYPO3 版本仍有区别,它们现在也必须注册,在 TCA 中,它们也只能通过注册名称引用。在 TCA 文件中,这里没有引用图标,但下面的类使用了它。这是一个如何在 ext_tables.php 中注册图标的示例:
$systemIconRegistry = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Imaging\IconRegistry::class);
$systemIconRegistry->registerIcon(
'imagemapwizard_link_edit',
\TYPO3\CMS\Core\Imaging\IconProvider\BitmapIconProvider::class,
[
'source' => 'EXT:imagemap_wizard/Resources/Public/Icons/link_edit.png'
]
);
从 TYPO3 版本 7.5 开始实施新的图标注册表