如何在typo3 7 TCA中添加自定义向导?
当我尝试在TCA中添加名为wizard\u geo\u selector的向导时,出现了一个错误“模块未注册”。请告诉我如何在TCA中正确注册向导。?在TCA中添加向导,如下所示:如何在typo3 7 TCA中添加自定义向导?,typo3,typo3-7.x,Typo3,Typo3 7.x,当我尝试在TCA中添加名为wizard\u geo\u selector的向导时,出现了一个错误“模块未注册”。请告诉我如何在TCA中正确注册向导。?在TCA中添加向导,如下所示: 'module' => array( 'name' => 'wizard_geo_selector', ), 在ext_tables.php中注册向导 \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addModulePath( '
'module' => array(
'name' => 'wizard_geo_selector',
),
在ext_tables.php中注册向导
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addModulePath(
'wizard_geo_selector',
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($_EXTKEY) . 'Modules/Wizards/Yourwizardname/'
);
请记住,这是自Typo3 7以来被弃用的,并在Typo3 8中被删除。因此,您可以在Typo3 7之前使用此方法。对于Typo3 8,请使用下面指定的方法。Ricky的答案不再有效,因为addModulePath自第7版起就被弃用 另外,像这样注册模块仍然会出现您所说的错误 使向导再次运行的唯一原因是:
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addModule('wizard','pbsurvey\u answers','',\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($\u EXTKEY)。'wizard/';
但是,当您添加此项时,模块将在TYPO3后端显示为一个新点。在TYPO3 7.6版中,新向导的添加方式如下:
Configuration/Backend/
Routes.php
,该文件将自动找到,不需要在ext_localconf.php或ext_tables.php
中提及。如果仍然需要Ajax,可以将文件ajaxrouts.php
添加到同一文件夹中
Routes.php的内容
:
return array(
'my_wizard_element' => array(
'path' => '/wizard/tx_geoselecotor/geo_selector_wizard',
'target' => \Path\To\your\class\WizardGeoSelector::class . '::WizardAction'
),
);
<?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'
));
在userFuncPath/to/class/without/wizard->renderForm
中,您必须创建一个链接到向导的按钮,单击该按钮,向导将打开您在Routes.php中定义的路由和可选的URL参数
目前,我从未在核心文档中找到解释过的整个项目
编辑:有关路由的详细信息可在此处找到: 可以在以下位置找到渲染过程: 您可能还应该阅读链接段落的外部上下文 编辑2:
在这里可以找到一个扩展示例,有些东西永远不会100%工作,但向导正在工作。扩展名适用于TYPO3版本7:
给出了相同的错误“模块应用向导未配置”。david的回答很有魅力,这就是解决方法。你能解释一下tca这样的完整代码吗configuration@BharatParmarTCA配置在我的示例第4点中。它是要添加向导的字段的配置区域。
'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',
),
),