gpt4 book ai didi

typo3 - 如何在typo3 7 TCA 中添加自定义向导?

转载 作者:行者123 更新时间:2023-12-04 17:31:17 25 4
gpt4 key购买 nike

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

最佳答案

在 TYPO3 7.6 版中,新向导添加如下:

  • 在您的扩展程序中创建目录 Configuration/Backend/
  • 在新目录中创建一个文件 Routes.php ,会自动找到的,不提in ext_localconf.phpext_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)路由,定义的字符串没有变化。
  • 现在可以使用该向导,甚至不必在 ext_tables.php 中定义它,也必须从配置区域(模块 [名称])的任何表字段中提及它:
    '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/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com