如何在typo3 7 TCA中添加自定义向导? [英] How to add custom wizards in typo3 7 TCA?

查看:71
本文介绍了如何在typo3 7 TCA中添加自定义向导?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试在TCA中添加名为wizard_geo_selector的向导时,出现错误模块未注册".请告诉我如何在TCA中正确注册该向导.?

When I try to add the wizard named wizard_geo_selector in TCA ,there arised an error "module not registered".Please tell me how to register the wizard properly in the TCA.?

推荐答案

在TYPO3版本7.6中,添加了新的向导,如下所示:

In TYPO3 Version 7.6 new wizards are added like this:

  1. 在扩展程序内创建目录Configuration/Backend/
  2. 在新目录中创建文件Routes.php,将自动找到该文件,无需提及in ext_localconf.phpext_tables.php.如果仍然需要Ajax,则可以将文件AjaxRoutes.php添加到同一文件夹中.
  3. Routes.php的内容:

  1. Inside your extension create the directory Configuration/Backend/
  2. In the new directory create a file Routes.php, it will be found automatically, no mentioning in ext_localconf.php or ext_tables.php is required. If you still need Ajax you can add the file AjaxRoutes.php in the same folder.
  3. Content for 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'
 ));

如果不确定表示法,可以将其与后端的全局变量中的现有条目进行比较:

If you're unsure about the notation you can compare with existing entries in the Global Variables in the Backend:

导航到系统->配置->后端路由

Navigate to System -> Configuration -> Backend Routes

路径的处理方式有所不同,对于Ajax而言,它始终以"ajax"为前缀,因此您永远不必将其添加到路径中,否则它是路径中的两倍.对于通用路由,定义的字符串没有任何变化.

The route of the paths is handled different, for Ajax it's always "ajax" prepended, so you've never to add it to the path, else it's twice in the route. For the common route there is no change concerning the defined string.

  1. 现在可以使用该向导,甚至不必在ext_tables.php中对其进行定义,也必须在配置区域(模块[名称])的任何表字段中都提及该向导:

  1. Now the wizard can be used and even it never has to be defined in ext_tables.php it has to be mentioned there from any table-field in the configuration-area (module[name]):

'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打开.

In the userFunc Path/to/class/without/wizard->renderForm you've to create a button which is linking to the wizard and onClick the wizard will open with the route you defined in Routes.php and the optional urlParameters.

目前,我从没有找到核心文档中解释的整个项目.

Currently I never found this whole item explained in the core-documentation.

修改:
可以在以下位置找到有关路由的详细信息:路由


Details about routing can be found here: Routing

可以在此处找到渲染过程:渲染/NodeFactory 您可能还应该阅读链接段落的外部上下文.

The rendering process can be found here: Rendering / NodeFactory You should probably read also the outer context of the linked paragraph.


可以在此处找到示例扩展,某些功能永远无法100%正常运行,但向导仍在运行.该扩展适用于TYPO3版本7:
https://github.com/DavidBruchmann/imagemap_wizard

Edit 2:
An example extension can be found here, some things never work 100% but the wizard is working. The extension is for TYPO3 Version 7:
https://github.com/DavidBruchmann/imagemap_wizard

这篇关于如何在typo3 7 TCA中添加自定义向导?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆