[TASK] Migrate EXT:form Backend Wizard to Routing 66/44466/2
authorBenjamin Mack <benni@typo3.org>
Sat, 31 Oct 2015 21:14:28 +0000 (22:14 +0100)
committerWouter Wolters <typo3@wouterwolters.nl>
Mon, 2 Nov 2015 08:57:12 +0000 (09:57 +0100)
Resolves: #71226
Change-Id: Ia5dbbcf067a8887965dfca29f7916e41db0ec6cb
Reviewed-on: https://review.typo3.org/44466
Reviewed-by: Robert van Kammen <rvkammen@hotmail.com>
Tested-by: Robert van Kammen <rvkammen@hotmail.com>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
typo3/sysext/form/Classes/Controller/WizardController.php
typo3/sysext/form/Classes/View/Wizard/WizardView.php
typo3/sysext/form/Configuration/Backend/Routes.php [new file with mode: 0644]
typo3/sysext/form/Modules/Wizards/FormWizard/conf.php [deleted file]
typo3/sysext/form/Modules/Wizards/FormWizard/index.php [deleted file]
typo3/sysext/form/ext_tables.php

index 5f93f7c..34c86f8 100644 (file)
@@ -37,13 +37,17 @@ class WizardController
      *
      * The action which should be taken when the wizard is loaded
      *
-     * @return void
+     * @param ServerRequestInterface $request
+     * @param ResponseInterface $response
+     * @return ResponseInterface returns a 500 error or a valid JSON response
      */
-    public function indexAction()
+    public function indexAction(ServerRequestInterface $request, ResponseInterface $response)
     {
         /** @var $view \TYPO3\CMS\Form\View\Wizard\WizardView */
         $view = GeneralUtility::makeInstance(\TYPO3\CMS\Form\View\Wizard\WizardView::class, $this->getRepository());
-        $view->render();
+        $content = $view->render();
+        $response->getBody()->write($content);
+        return $response;
     }
 
     /**
index b284050..2a56f42 100644 (file)
@@ -89,9 +89,9 @@ class WizardView
     /**
      * The main render method
      *
-     * Gathers all content and echos it to the screen
+     * Gathers all content and returns it
      *
-     * @return void
+     * @return string
      */
     public function render()
     {
@@ -119,10 +119,7 @@ class WizardView
         $content = $this->doc->startPage($this->getLanguageService()->getLL('title', true));
         $content .= $this->doc->moduleBody(array(), $docHeaderButtons, $markers);
         $content .= $this->doc->endPage();
-        $content = $this->doc->insertStylesAndJS($content);
-
-        echo $content;
-        die;
+        return $this->doc->insertStylesAndJS($content);
     }
 
     /**
diff --git a/typo3/sysext/form/Configuration/Backend/Routes.php b/typo3/sysext/form/Configuration/Backend/Routes.php
new file mode 100644 (file)
index 0000000..14524e7
--- /dev/null
@@ -0,0 +1,13 @@
+<?php
+use TYPO3\CMS\Form\Controller\WizardController;
+
+/**
+ * Definitions for Routes provided by EXT:form
+ */
+return [
+    // Loads the form HTML page
+    'wizard_form' => [
+        'path' => '/wizard/form/show',
+        'target' => WizardController::class . '::indexAction'
+    ],
+];
diff --git a/typo3/sysext/form/Modules/Wizards/FormWizard/conf.php b/typo3/sysext/form/Modules/Wizards/FormWizard/conf.php
deleted file mode 100644 (file)
index ae0886b..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-<?php
-$MCONF['name'] = 'wizard_form';
-$MCONF['script'] = '_DISPATCH';
diff --git a/typo3/sysext/form/Modules/Wizards/FormWizard/index.php b/typo3/sysext/form/Modules/Wizards/FormWizard/index.php
deleted file mode 100644 (file)
index e885c0f..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-<?php
-/*
- * This file is part of the TYPO3 CMS project.
- *
- * It is free software; you can redistribute it and/or modify it under
- * the terms of the GNU General Public License, either version 2
- * of the License, or any later version.
- *
- * For the full copyright and license information, please read the
- * LICENSE.txt file that was distributed with this source code.
- *
- * The TYPO3 project - inspiring people to share!
- */
-
-/**
- * @var $wizard \TYPO3\CMS\Form\Controller\WizardController
- */
-$wizard = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Form\Controller\WizardController::class);
-$wizard->indexAction();
index ea52792..6d53f03 100644 (file)
@@ -3,11 +3,3 @@ defined('TYPO3_MODE') or die();
 
 // Register static TypoScript resource
 \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addStaticFile('form', 'Configuration/TypoScript/', 'Default TS');
-
-if (TYPO3_MODE === 'BE') {
-    // Register form wizard as backend module
-    \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addModulePath(
-        'wizard_form',
-        'EXT:form/Modules/Wizards/FormWizard/'
-    );
-}