当我尝试在 TCA 中添加名为 wizard_geo_selector 的向导时,出现“模块未注册”错误。请告诉我如何在 TCA 中正确注册向导。?
最佳答案
在 TYPO3 7.6 版中,新向导添加如下:
Configuration/Backend/
Routes.php
,会自动找到的,不提in ext_localconf.php
或 ext_tables.php
是必须的。如果您仍然需要 Ajax,您可以添加文件 AjaxRoutes.php
在同一个文件夹中。 Routes.php
的内容:return array(
'my_wizard_element' => array(
'path' => '/wizard/tx_geoselecotor/geo_selector_wizard',
'target' => \Path\To\your\class\WizardGeoSelector::class . '::WizardAction'
),
);
AjaxRoutes.php
的内容<?php
/**
* Definitions for routes provided by EXT:backend
* Contains all AJAX-based routes for entry points
*
* Currently the "access" property is only used so no token creation + validation is made
* but will be extended further.
*/
return array('my_ajax_element' => array(
'path' => 'tx_geoselecotor/my_ajax_route',
'target' => \Path\To\your\class\MyAjaxController::class .'::myAjaxFunction'
));
如果您不确定该表示法,您可以将其与后端全局变量中的现有条目进行比较:
Navigate to System -> Configuration -> Backend Routes
路径的路由处理方式不同,对于 Ajax,它总是预先添加“ajax”,所以你永远不会将它添加到路径中,否则它会在路径中出现两次。对于公共(public)路由,定义的字符串没有变化。
'table_field_for_wizard' => array(
'label' => 'LLL:EXT:my_extension/Resources/Private/Language/locallang.xml:table_name.tx_myextension_wizard',
'config' => array (
'type' => 'user',
'userFunc' => 'Path/to/class/without/wizard->renderForm',
'wizards' => array(
'my_wizard' => array(
'type' => 'popup',
'title' => 'MyTitle',
'JSopenParams' => 'height=700,width=780,status=0,menubar=0,scrollbars=1',
'icon' => 'EXT:' . $_EXTKEY . '/Resources/Public/img/link_popup.gif',
'module' => array(
'name' => 'my_wizard_element',
'urlParameters' => array(
'mode' => 'wizard',
'ajax' => '0',
'any' => '... parameters you need'
),
),
),
'_VALIGN' => 'middle',
'_PADDING' => '4',
),
# Optional
#'softref'=>'something',
),
),
在 userFunc
Path/to/class/without/wizard->renderForm
您必须创建一个链接到向导的按钮,onClick 向导将打开您在 Routes.php 中定义的路由和可选的 urlParameters。目前我从未在核心文档中找到解释过的整个项目。
编辑:
可以在此处找到有关路由的详细信息:Routing
渲染过程可以在这里找到:Rendering / NodeFactory
您可能还应该阅读链接段落的外部上下文。
编辑 2:
可以在这里找到一个示例扩展,有些事情永远不会 100% 工作,但向导正在工作。该扩展适用于 TYPO3 版本 7:
https://github.com/DavidBruchmann/imagemap_wizard
关于typo3 - 如何在typo3 7 TCA 中添加自定义向导?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38099950/