[TASK] EXT:form - remove bootstrap class 68/43468/3
authorRalf Zimmermann <ralf.zimmermann@tritum.de>
Tue, 22 Sep 2015 10:24:23 +0000 (12:24 +0200)
committerOliver Hader <oliver.hader@typo3.org>
Wed, 23 Sep 2015 10:49:08 +0000 (12:49 +0200)
Remove the Bootstrap class to behave like other core extensions. This fixes also the issue that the "Mail form" plugin is not shown anymore within the new content element wizard.

Resolves: #69958
Releases: master
Change-Id: I130b774c310ef7582b8a46ad0733319739d7d2ed
Reviewed-on: http://review.typo3.org/43468
Reviewed-by: Bjoern Jacob <bjoern.jacob@tritum.de>
Tested-by: Bjoern Jacob <bjoern.jacob@tritum.de>
Reviewed-by: Oliver Hader <oliver.hader@typo3.org>
Tested-by: Oliver Hader <oliver.hader@typo3.org>
12 files changed:
typo3/sysext/form/Classes/Bootstrap.php [deleted file]
typo3/sysext/form/Classes/Domain/Builder/ElementBuilder.php
typo3/sysext/form/Classes/Domain/Builder/FormBuilder.php
typo3/sysext/form/Classes/Domain/Builder/ValidationBuilder.php
typo3/sysext/form/Classes/Domain/Model/Configuration.php
typo3/sysext/form/Classes/Mvc/Controller/ControllerContext.php
typo3/sysext/form/Classes/Utility/CompatibilityLayerUtility.php
typo3/sysext/form/Classes/Utility/FormUtility.php
typo3/sysext/form/Classes/Utility/TypoScriptToJsonConverter.php
typo3/sysext/form/Configuration/PageTS/modWizards.ts
typo3/sysext/form/ext_localconf.php
typo3/sysext/form/ext_tables.php

diff --git a/typo3/sysext/form/Classes/Bootstrap.php b/typo3/sysext/form/Classes/Bootstrap.php
deleted file mode 100644 (file)
index dd3ec7e..0000000
+++ /dev/null
@@ -1,122 +0,0 @@
-<?php
-namespace TYPO3\CMS\Form;
-
-/*
- * 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!
- */
-
-use TYPO3\CMS\Core\Utility\GeneralUtility;
-use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
-use TYPO3\CMS\Extbase\Utility\ExtensionUtility;
-use TYPO3\CMS\Form\Hooks\PageLayoutView\MailformPreviewRenderer;
-use TYPO3\CMS\Form\Hooks\ContentObjectHook;
-use TYPO3\CMS\Form\Domain\Property\TypeConverter\ArrayToValidationElementConverter;
-
-/**
- * Bootstrapping EXT:form configuration & behavior
- */
-class Bootstrap {
-
-       /**
-        * Gets registered element names that can be used
-        * in form's pseudo TypoScript to define form elements.
-        *
-        * @return array
-        */
-       static public function getRegisteredElementNames() {
-               return array(
-                       'BUTTON',
-                       'CHECKBOX',
-                       'CHECKBOXGROUP',
-                       'FIELDSET',
-                       'FILEUPLOAD',
-                       'HEADER',
-                       'HIDDEN',
-                       'IMAGEBUTTON',
-                       'OPTGROUP',
-                       'OPTION',
-                       'PASSWORD',
-                       'RADIO',
-                       'RADIOGROUP',
-                       'RESET',
-                       'SELECT',
-                       'SUBMIT',
-                       'TEXTAREA',
-                       'TEXTBLOCK',
-                       'TEXTLINE'
-               );
-       }
-
-       /**
-        * Initializes configuration.
-        */
-       static public function initializeConfiguration() {
-               // Apply PageTSconfig
-               ExtensionManagementUtility::addPageTSConfig(
-                       '<INCLUDE_TYPOSCRIPT: source="FILE:EXT:form/Configuration/PageTS/modWizards.ts">'
-               );
-
-               // Backend view
-               $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/layout/class.tx_cms_layout.php']['tt_content_drawItem']['mailform'] = MailformPreviewRenderer::class;
-
-               // Handling of cObjects "FORM" and "FORM_INT"
-               $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_content.php']['cObjTypeAndClass'][] = array('FORM', ContentObjectHook::class);
-               $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_content.php']['cObjTypeAndClass'][] = array('FORM_INT', ContentObjectHook::class);
-
-               // Extbase handling
-               ExtensionUtility::registerTypeConverter(
-                       ArrayToValidationElementConverter::class
-               );
-               ExtensionUtility::configurePlugin(
-                       'TYPO3.CMS.Form',
-                       'Form',
-                       array('Frontend' => 'show, confirmation, dispatchConfirmationButtonClick, process, afterProcess'),
-                       array('Frontend' => 'show, confirmation, dispatchConfirmationButtonClick, process, afterProcess')
-               );
-       }
-
-       /**
-        * Initializes settings.
-        */
-       static public function initializeSettings() {
-               // Register form wizard as backend module
-               ExtensionManagementUtility::addModulePath(
-                       'wizard_form',
-                       'EXT:form/Modules/Wizards/FormWizard/'
-               );
-
-               // Register static TypoScript resource
-               ExtensionManagementUtility::addStaticFile('form', 'Configuration/TypoScript/', 'Default TS');
-       }
-
-       /**
-        * Registers slots.
-        */
-       static public function registerSlots() {
-               $signalSlotDispatcher = GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\SignalSlot\Dispatcher::class);
-
-               $signalSlotDispatcher->connect(
-                       \TYPO3\CMS\Form\Domain\Builder\FormBuilder::class,
-                       'txFormHandleIncomingValues',
-                       \TYPO3\CMS\Form\Hooks\HandleIncomingFormValues::class,
-                       'handleIncomingFormValues'
-               );
-       }
-
-       /**
-        * @return \TYPO3\CMS\Extbase\Object\ObjectManager
-        */
-       static public function getObjectManager() {
-               return GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\Object\ObjectManager::class);
-       }
-
-}
\ No newline at end of file
index 0fc507f..c76eb39 100644 (file)
@@ -31,7 +31,7 @@ class ElementBuilder {
         */
        static public function create(FormBuilder $formBuilder, Element $element, array $userDefinedTypoScript) {
                /** @var ElementBuilder $elementBuilder */
-               $elementBuilder = \TYPO3\CMS\Form\Bootstrap::getObjectManager()->get(ElementBuilder::class);
+               $elementBuilder = \TYPO3\CMS\Form\Utility\FormUtility::getObjectManager()->get(ElementBuilder::class);
                $elementBuilder->setFormBuilder($formBuilder);
                $elementBuilder->setElement($element);
                $elementBuilder->setUserConfiguredElementTyposcript($userDefinedTypoScript);
index 6ec1db1..d162a15 100644 (file)
@@ -41,7 +41,7 @@ class FormBuilder {
         */
        static public function create(Configuration $configuration) {
                /** @var FormBuilder $formBuilder */
-               $formBuilder = \TYPO3\CMS\Form\Bootstrap::getObjectManager()->get(FormBuilder::class);
+               $formBuilder = \TYPO3\CMS\Form\Utility\FormUtility::getObjectManager()->get(FormBuilder::class);
                $formBuilder->setConfiguration($configuration);
                return $formBuilder;
        }
index 7ac4c07..3af02b4 100644 (file)
@@ -29,7 +29,7 @@ class ValidationBuilder {
         */
        static public function create(Configuration $configuration) {
                /** @var ValidationBuilder $validationBuilder */
-               $validationBuilder = \TYPO3\CMS\Form\Bootstrap::getObjectManager()->get(ValidationBuilder::class);
+               $validationBuilder = \TYPO3\CMS\Form\Utility\FormUtility::getObjectManager()->get(ValidationBuilder::class);
                $validationBuilder->setConfiguration($configuration);
                return $validationBuilder;
        }
index 1370d88..039a3d2 100644 (file)
@@ -34,7 +34,7 @@ class Configuration {
         * @return Configuration
         */
        static public function create() {
-               return \TYPO3\CMS\Form\Bootstrap::getObjectManager()->get(Configuration::class);
+               return \TYPO3\CMS\Form\Utility\FormUtility::getObjectManager()->get(Configuration::class);
        }
 
        /**
index 01d40e5..22d6d10 100644 (file)
@@ -30,7 +30,7 @@ class ControllerContext extends \TYPO3\CMS\Extbase\Mvc\Controller\ControllerCont
         * @return ControllerContext
         */
        static public function extend(\TYPO3\CMS\Extbase\Mvc\Controller\ControllerContext $source) {
-               $controllerContext = \TYPO3\CMS\Form\Bootstrap::getObjectManager()->get(ControllerContext::class);
+               $controllerContext = \TYPO3\CMS\Form\Utility\FormUtility::getObjectManager()->get(ControllerContext::class);
                $propertyNames = ObjectAccess::getGettableProperties($source);
                foreach ($propertyNames as $propertyName => $propertyValue) {
                        ObjectAccess::setProperty($controllerContext, $propertyName, $propertyValue);
index 7b43567..b26337f 100644 (file)
@@ -30,7 +30,7 @@ class CompatibilityLayerUtility {
         */
        static public function create(FormBuilder $formBuilder) {
                /** @var CompatibilityLayerUtility $compatibilityService */
-               $compatibilityService = \TYPO3\CMS\Form\Bootstrap::getObjectManager()->get(CompatibilityLayerUtility::class);
+               $compatibilityService = \TYPO3\CMS\Form\Utility\FormUtility::getObjectManager()->get(CompatibilityLayerUtility::class);
                $compatibilityService->setFormBuilder($formBuilder);
                return $compatibilityService;
        }
index 8231126..50b29bd 100644 (file)
@@ -14,6 +14,8 @@ namespace TYPO3\CMS\Form\Utility;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Core\Utility\GeneralUtility;
+
 /**
  * A session utility
  */
@@ -80,4 +82,10 @@ class FormUtility implements \TYPO3\CMS\Core\SingletonInterface {
                return $id;
        }
 
+       /**
+        * @return \TYPO3\CMS\Extbase\Object\ObjectManager
+        */
+       static public function getObjectManager() {
+               return GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\Object\ObjectManager::class);
+       }
 }
index 39d4010..7b36426 100644 (file)
@@ -24,6 +24,28 @@ use TYPO3\CMS\Form\Domain\Model\Json\AbstractJsonElement;
  */
 class TypoScriptToJsonConverter {
 
+       protected $registeredElementNames = array(
+               'BUTTON',
+               'CHECKBOX',
+               'CHECKBOXGROUP',
+               'FIELDSET',
+               'FILEUPLOAD',
+               'HEADER',
+               'HIDDEN',
+               'IMAGEBUTTON',
+               'OPTGROUP',
+               'OPTION',
+               'PASSWORD',
+               'RADIO',
+               'RADIOGROUP',
+               'RESET',
+               'SELECT',
+               'SUBMIT',
+               'TEXTAREA',
+               'TEXTBLOCK',
+               'TEXTLINE'
+       );
+
        /**
         * @var array
         */
@@ -105,7 +127,7 @@ class TypoScriptToJsonConverter {
         * @return void
         */
        private function setElementType(AbstractJsonElement $parentElement, $class, array $arguments) {
-               if (in_array($class, \TYPO3\CMS\Form\Bootstrap::getRegisteredElementNames())) {
+               if (in_array($class, $this->registeredElementNames)) {
                        if (strstr($arguments['class'], 'predefined-name')) {
                                $class = 'NAME';
                        }
index cc86e52..e7e5504 100644 (file)
@@ -1,13 +1,20 @@
 mod.wizards {
        newContentElement.wizardItems {
-               forms.elements {
-                       mailform {
-                               tt_content_defValues {
-                                       bodytext (
+               forms {
+                       show :=addToList(mailform)
+                       elements {
+                               mailform {
+                                       icon = EXT:frontend/Resources/Public/Icons/ContentElementWizard/mailform.gif
+                                       title = LLL:EXT:backend/Resources/Private/Language/locallang_db_new_content_el.xlf:forms_mail_title
+                                       description = LLL:EXT:backend/Resources/Private/Language/locallang_db_new_content_el.xlf:forms_mail_description
+                                       tt_content_defValues {
+                                               CType = mailform
+                                               bodytext (
 enctype = multipart/form-data
 method = post
 prefix = tx_form
-                                       )
+                                               )
+                                       }
                                }
                        }
                }
index 7d66465..57ba337 100644 (file)
@@ -1,5 +1,43 @@
 <?php
 defined('TYPO3_MODE') or die();
 
-\TYPO3\CMS\Form\Bootstrap::initializeConfiguration();
-\TYPO3\CMS\Form\Bootstrap::registerSlots();
\ No newline at end of file
+if (TYPO3_MODE === 'BE') {
+       // Apply PageTSconfig
+       \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPageTSConfig(
+               '<INCLUDE_TYPOSCRIPT: source="FILE:EXT:form/Configuration/PageTS/modWizards.ts">'
+       );
+
+       // Backend view
+       $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/layout/class.tx_cms_layout.php']['tt_content_drawItem']['mailform'] =
+               \TYPO3\CMS\Form\Hooks\PageLayoutView\MailformPreviewRenderer::class;
+} else {
+       // Handling of cObjects "FORM" and "FORM_INT"
+       $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_content.php']['cObjTypeAndClass'][] = array(
+               'FORM',
+               \TYPO3\CMS\Form\Hooks\ContentObjectHook::class
+       );
+       $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_content.php']['cObjTypeAndClass'][] = array(
+               'FORM_INT',
+               \TYPO3\CMS\Form\Hooks\ContentObjectHook::class
+       );
+
+       // Extbase handling
+       \TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerTypeConverter(
+               \TYPO3\CMS\Form\Domain\Property\TypeConverter\ArrayToValidationElementConverter::class
+       );
+
+       \TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
+               'TYPO3.CMS.Form',
+               'Form',
+               array('Frontend' => 'show, confirmation, dispatchConfirmationButtonClick, process, afterProcess'),
+               array('Frontend' => 'show, confirmation, dispatchConfirmationButtonClick, process, afterProcess')
+       );
+
+       $signalSlotDispatcher = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\SignalSlot\Dispatcher::class);
+       $signalSlotDispatcher->connect(
+               \TYPO3\CMS\Form\Domain\Builder\FormBuilder::class,
+               'txFormHandleIncomingValues',
+               \TYPO3\CMS\Form\Hooks\HandleIncomingFormValues::class,
+               'handleIncomingFormValues'
+       );
+}
index e425d6d..fc87827 100644 (file)
@@ -1,4 +1,13 @@
 <?php
 defined('TYPO3_MODE') or die();
 
-\TYPO3\CMS\Form\Bootstrap::initializeSettings();
+// 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/'
+       );
+}