Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add custom wizards in typo3 7 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.?

like image 344
ebin mathew Avatar asked Dec 18 '22 15:12

ebin mathew


1 Answers

In TYPO3 Version 7.6 new wizards are added like this:

  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'
        ),
    );
    

Content for 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

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. 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',
        ),
    ),
    

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.

Edit:
Details about routing can be found here: Routing

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

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

like image 120
David Avatar answered Dec 31 '22 14:12

David