[TASK] Remove class alias map in form 77/40977/4
authorHelmut Hummel <helmut.hummel@typo3.org>
Tue, 7 Jul 2015 17:51:20 +0000 (19:51 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Wed, 8 Jul 2015 05:19:08 +0000 (07:19 +0200)
The alias map in form system extension is a workaround
to enable case insensitive class loading for specific
form classes.

Instead of misusing this technology, introduce an object factory
class which does the mapping within the form extension where it belongs
without affecting the complete system.

By doing so and removing the last alias map (besides the one in compatibility6)
we now have to improve our code for dynamic alias addition since the default
loader is not the alias loader any more but the regular composer class loader.

Releases: master
Resolves: #67969
Change-Id: I3b191b7643c33f311f4ca2b82f7da3c8dfff0f2c
Reviewed-on: http://review.typo3.org/40977
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
23 files changed:
composer.json
typo3/sysext/core/Classes/Core/ClassLoadingInformation.php
typo3/sysext/form/Classes/Domain/Factory/TypoScriptFactory.php
typo3/sysext/form/Classes/Domain/Model/Additional/AdditionalAdditionalElement.php
typo3/sysext/form/Classes/Domain/Model/Attribute/AttributesAttribute.php
typo3/sysext/form/Classes/Domain/Model/Element/AbstractElement.php
typo3/sysext/form/Classes/ObjectFactory.php [new file with mode: 0644]
typo3/sysext/form/Classes/PostProcess/PostProcessor.php
typo3/sysext/form/Classes/Utility/FilterUtility.php
typo3/sysext/form/Classes/Utility/TypoScriptToJsonConverter.php
typo3/sysext/form/Classes/Utility/ValidatorUtility.php
typo3/sysext/form/Classes/Validation/AlphabeticValidator.php
typo3/sysext/form/Classes/Validation/AlphanumericValidator.php
typo3/sysext/form/Classes/Validation/DigitValidator.php
typo3/sysext/form/Classes/View/Confirmation/Element/AbstractElementView.php
typo3/sysext/form/Classes/View/Confirmation/Element/ContainerElementView.php
typo3/sysext/form/Classes/View/Form/Element/AbstractElementView.php
typo3/sysext/form/Classes/View/Form/Element/ContainerElementView.php
typo3/sysext/form/Classes/View/Mail/Html/Element/AbstractElementView.php
typo3/sysext/form/Classes/View/Mail/Html/Element/ContainerElementView.php
typo3/sysext/form/Classes/View/Mail/Plain/Element/ContainerElementView.php
typo3/sysext/form/Migrations/Code/ClassAliasMap.php [deleted file]
typo3/sysext/form/composer.json

index 6e061d1..792c5f0 100644 (file)
@@ -40,7 +40,7 @@
                "symfony/console": "2.5.11",
                "symfony/finder": "2.6.9",
                "doctrine/instantiator": "1.0.4",
-               "helhum/class-alias-loader": "1.1.8",
+               "helhum/class-alias-loader": "1.1.9",
                "typo3/cms-composer-installers": "1.2.1"
        },
        "require-dev": {
        "extra": {
                "branch-alias": {
                        "dev-master": "7.x-dev"
-               },
-               "class-alias-maps": [
-                       "typo3/sysext/form/Migrations/Code/ClassAliasMap.php"
-               ]
+               }
        },
        "replace": {
                "typo3/cms-about": "self.version",
index f5604c9..705bfe6 100644 (file)
@@ -15,6 +15,7 @@ namespace TYPO3\CMS\Core\Core;
  */
 
 use Composer\Autoload\ClassLoader as ComposerClassLoader;
+use Helhum\ClassAliasLoader\Composer\ClassAliasLoader;
 use TYPO3\CMS\Core\Package\PackageInterface;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 
@@ -82,7 +83,7 @@ class ClassLoadingInformation {
                if (file_exists($dynamicClassAliasMapFile)) {
                        $classAliasMap = require $dynamicClassAliasMapFile;
                        if (is_array($classAliasMap) && !empty($classAliasMap['aliasToClassNameMapping']) && !empty($classAliasMap['classNameToAliasMapping'])) {
-                               $composerClassLoader->addAliasMap($classAliasMap);
+                               self::getClassAliasLoader($composerClassLoader)->addAliasMap($classAliasMap);
                        }
                }
 
@@ -118,9 +119,9 @@ class ClassLoadingInformation {
                foreach ($classInformation['psr-4'] as $prefix => $paths) {
                        $composerClassLoader->setPsr4($prefix, $paths);
                }
-               if (is_callable(array($composerClassLoader, 'addAliasMap'))) {
-                       $aliasMap = ClassLoadingInformationGenerator::buildClassAliasMapForPackage($package);
-                       $composerClassLoader->addAliasMap($aliasMap);
+               $classAliasMap = ClassLoadingInformationGenerator::buildClassAliasMapForPackage($package);
+               if (is_array($classAliasMap) && !empty($classAliasMap['aliasToClassNameMapping']) && !empty($classAliasMap['classNameToAliasMapping'])) {
+                       self::getClassAliasLoader($composerClassLoader)->addAliasMap($classAliasMap);
                }
        }
 
@@ -158,4 +159,22 @@ class ClassLoadingInformation {
                return Bootstrap::getInstance()->getEarlyInstance(ComposerClassLoader::class);
        }
 
+       /**
+        * Internal method calling the bootstrap to fetch the composer class loader
+        *
+        * @param ClassAliasLoader|ComposerClassLoader $composerClassLoader
+        * @return ClassAliasLoader
+        * @throws \TYPO3\CMS\Core\Exception
+        */
+       static protected function getClassAliasLoader($composerClassLoader) {
+               if ($composerClassLoader instanceof ClassAliasLoader) {
+                       return $composerClassLoader;
+               }
+               $aliasLoader = new ClassAliasLoader($composerClassLoader);
+               $aliasLoader->register(TRUE);
+               Bootstrap::getInstance()->setEarlyInstance(ComposerClassLoader::class, $aliasLoader);
+
+               return $aliasLoader;
+       }
+
 }
index baf431c..3360cd8 100644 (file)
@@ -18,6 +18,7 @@ use TYPO3\CMS\Core\TimeTracker\TimeTracker;
 use TYPO3\CMS\Core\TypoScript\TemplateService;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Form\Domain\Model\Element\AbstractElement;
+use TYPO3\CMS\Form\ObjectFactory;
 
 /**
  * Typoscript factory for form
@@ -184,7 +185,7 @@ class TypoScriptFactory implements \TYPO3\CMS\Core\SingletonInterface {
                        $className = 'TYPO3\\CMS\\Form\\Domain\\Model\\Element\\' . ucfirst($class) . 'Element';
                }
                /* @var $object AbstractElement */
-               $object = GeneralUtility::makeInstance($className);
+               $object = ObjectFactory::createFormObject($className);
                if ($object->getElementType() === AbstractElement::ELEMENT_TYPE_CONTENT) {
                        $object->setData($arguments['cObj'], $arguments['cObj.']);
                } elseif ($object->getElementType() === AbstractElement::ELEMENT_TYPE_PLAIN) {
index 2352eba..99b6283 100644 (file)
@@ -13,6 +13,7 @@ namespace TYPO3\CMS\Form\Domain\Model\Additional;
  *
  * The TYPO3 project - inspiring people to share!
  */
+use TYPO3\CMS\Form\ObjectFactory;
 
 /**
  * Additional elements for FORM object
@@ -39,7 +40,7 @@ class AdditionalAdditionalElement {
        public function addAdditional($class, $type, $value) {
                $class = strtolower((string)$class);
                $className = 'TYPO3\\CMS\\Form\\Domain\\Model\\Additional\\' . ucfirst($class) . 'AdditionalElement';
-               $this->additional[$class] = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance($className, $type, $value);
+               $this->additional[$class] = ObjectFactory::createFormObject($className, $type, $value);
                return $this;
        }
 
index e587367..221b1c9 100644 (file)
@@ -15,6 +15,7 @@ namespace TYPO3\CMS\Form\Domain\Model\Attribute;
  */
 
 use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Form\ObjectFactory;
 
 /**
  * Attribute class for the form elements
@@ -67,7 +68,7 @@ class AttributesAttribute {
        public function addAttribute($class, $value) {
                $class = strtolower((string)$class);
                $className = 'TYPO3\\CMS\\Form\\Domain\\Model\\Attribute\\' . ucfirst($class) . 'Attribute';
-               $this->attributes[$class] = GeneralUtility::makeInstance($className, $value, $this->elementId);
+               $this->attributes[$class] = ObjectFactory::createFormObject($className, $value, $this->elementId);
                return $this;
        }
 
index 8941d3b..c113248 100644 (file)
@@ -16,6 +16,7 @@ namespace TYPO3\CMS\Form\Domain\Model\Element;
 
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Form\Filter\FilterInterface;
+use TYPO3\CMS\Form\ObjectFactory;
 
 /**
  * Abstract for the form elements
@@ -351,7 +352,7 @@ abstract class AbstractElement {
         */
        protected function createAttributes() {
                $className = \TYPO3\CMS\Form\Domain\Model\Attribute\AttributesAttribute::class;
-               $this->attributes = GeneralUtility::makeInstance($className, $this->elementId);
+               $this->attributes = ObjectFactory::createFormObject($className, $this->elementId);
        }
 
        /**
@@ -455,8 +456,7 @@ abstract class AbstractElement {
         * @return void
         */
        protected function createAdditional() {
-               $className = \TYPO3\CMS\Form\Domain\Model\Additional\AdditionalAdditionalElement::class;
-               $this->additional = GeneralUtility::makeInstance($className);
+               $this->additional = GeneralUtility::makeInstance(\TYPO3\CMS\Form\Domain\Model\Additional\AdditionalAdditionalElement::class);
        }
 
        /**
diff --git a/typo3/sysext/form/Classes/ObjectFactory.php b/typo3/sysext/form/Classes/ObjectFactory.php
new file mode 100644 (file)
index 0000000..b475395
--- /dev/null
@@ -0,0 +1,78 @@
+<?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;
+
+/**
+ * Class ObjectFactory
+ */
+class ObjectFactory {
+
+       /**
+        * @var array
+        */
+       static protected $nameMapping = array(
+               'typo3\\cms\\form\\domain\\model\\attribute\\acceptcharsetattribute' => \TYPO3\CMS\Form\Domain\Model\Attribute\AcceptCharsetAttribute::class,
+               'typo3\\cms\\form\\domain\\model\\element\\checkboxgroupelement' => \TYPO3\CMS\Form\Domain\Model\Element\CheckboxGroupElement::class,
+               'typo3\\cms\\form\\domain\\model\\element\\radiogroupelement' => \TYPO3\CMS\Form\Domain\Model\Element\RadioGroupElement::class,
+               'typo3\\cms\\form\\domain\\model\\json\\checkboxgroupjsonelement' => \TYPO3\CMS\Form\Domain\Model\Json\CheckboxGroupJsonElement::class,
+               'typo3\\cms\\form\\domain\\model\\json\\radiogroupjsonelement' => \TYPO3\CMS\Form\Domain\Model\Json\RadioGroupJsonElement::class,
+               'typo3\\cms\\form\\filter\\regexpfilter' => \TYPO3\CMS\Form\Filter\RegExpFilter::class,
+               'typo3\\cms\\form\\filter\\stripnewlinesfilter' => \TYPO3\CMS\Form\Filter\StripNewLinesFilter::class,
+               'typo3\\cms\\form\\filter\\titlecasefilter' => \TYPO3\CMS\Form\Filter\TitleCaseFilter::class,
+               'typo3\\cms\\form\\filter\\uppercasefilter' => \TYPO3\CMS\Form\Filter\UpperCaseFilter::class,
+               'typo3\\cms\\form\\validation\\fileallowedtypesvalidator' => \TYPO3\CMS\Form\Validation\FileAllowedTypesValidator::class,
+               'typo3\\cms\\form\\validation\\filemaximumsizevalidator' => \TYPO3\CMS\Form\Validation\FileMaximumSizeValidator::class,
+               'typo3\\cms\\form\\validation\\fileminimumsizevalidator' => \TYPO3\CMS\Form\Validation\FileMinimumSizeValidator::class,
+               'typo3\\cms\\form\\validation\\greaterthanvalidator' => \TYPO3\CMS\Form\Validation\GreaterThanValidator::class,
+               'typo3\\cms\\form\\validation\\inarrayvalidator' => \TYPO3\CMS\Form\Validation\InArrayValidator::class,
+               'typo3\\cms\\form\\validation\\regexpvalidator' => \TYPO3\CMS\Form\Validation\RegExpValidator::class,
+               'typo3\\cms\\form\\view\\confirmation\\element\\checkboxgroupelementview' => \TYPO3\CMS\Form\View\Confirmation\Element\CheckboxGroupElementView::class,
+               'typo3\\cms\\form\\view\\confirmation\\element\\radiogroupelementview' => \TYPO3\CMS\Form\View\Confirmation\Element\RadioGroupElementView::class,
+               'typo3\\cms\\form\\view\\form\\element\\checkboxgroupelementview' => \TYPO3\CMS\Form\View\Form\Element\CheckboxGroupElementView::class,
+               'typo3\\cms\\form\\view\\form\\element\\radiogroupelementview' => \TYPO3\CMS\Form\View\Form\Element\RadioGroupElementView::class,
+               'typo3\\cms\\form\\view\\mail\\html\\element\\checkboxgroupelementview' => \TYPO3\CMS\Form\View\Mail\Html\Element\CheckboxGroupElementView::class,
+               'typo3\\cms\\form\\view\\mail\\html\\element\\radiogroupelementview' => \TYPO3\CMS\Form\View\Mail\Html\Element\RadioGroupElementView::class,
+               'typo3\\cms\\form\\view\\mail\\plain\\element\\checkboxgroupelementview' => \TYPO3\CMS\Form\View\Mail\Plain\Element\CheckboxGroupElementView::class,
+               'typo3\\cms\\form\\view\\mail\\plain\\element\\radiogroupelementview' => \TYPO3\CMS\Form\View\Mail\Plain\Element\RadioGroupElementView::class,
+               'typo3\\cms\\form\\filter\\removexssfilter' => \TYPO3\CMS\Form\Filter\RemoveXssFilter::class,
+       );
+
+       /**
+        * @param string $alias
+        * @param string $originalClassName
+        */
+       static public function addToMap($alias, $originalClassName) {
+               self::$nameMapping[$alias] = $originalClassName;
+       }
+
+       /**
+        * @param string $classNameOrAlias
+        * @return object
+        */
+       static public function createFormObject($classNameOrAlias) {
+               $lowerCasedClassNameOrAlias = strtolower($classNameOrAlias);
+               if (!empty(self::$nameMapping[$lowerCasedClassNameOrAlias])) {
+                       $className = self::$nameMapping[$lowerCasedClassNameOrAlias];
+               } else {
+                       $className = $classNameOrAlias;
+               }
+               $arguments = func_get_args();
+               $arguments[0] = $className;
+               return call_user_func_array(array(GeneralUtility::class, 'makeInstance'), $arguments);
+       }
+
+}
\ No newline at end of file
index 7e2f4ed..a53ac8a 100644 (file)
@@ -15,6 +15,7 @@ namespace TYPO3\CMS\Form\PostProcess;
  */
 
 use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Form\ObjectFactory;
 
 /**
  * The post processor
@@ -81,7 +82,7 @@ class PostProcessor {
                                        $layout = $this->typoscriptFactory->getLayoutFromTypoScript($this->typoScript[$processorName . '.']);
                                        $layoutHandler->setLayout($layout);
 
-                                       $processor = GeneralUtility::makeInstance($className, $this->form, $processorArguments);
+                                       $processor = ObjectFactory::createFormObject($className, $this->form, $processorArguments);
                                        if ($processor instanceof PostProcessorInterface) {
                                                $html .= $processor->process();
                                        }
index 0497a4a..bc9e556 100644 (file)
@@ -15,6 +15,7 @@ namespace TYPO3\CMS\Form\Utility;
  */
 
 use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Form\ObjectFactory;
 
 /**
  * Static methods for filtering
@@ -104,9 +105,9 @@ class FilterUtility implements \TYPO3\CMS\Form\Filter\FilterInterface {
                $class = strtolower((string)$class);
                $className = 'TYPO3\\CMS\\Form\\Filter\\' . ucfirst($class) . 'Filter';
                if (is_null($arguments)) {
-                       $filter = GeneralUtility::makeInstance($className);
+                       $filter = ObjectFactory::createFormObject($className);
                } else {
-                       $filter = GeneralUtility::makeInstance($className, $arguments);
+                       $filter = ObjectFactory::createFormObject($className, $arguments);
                }
                return $filter;
        }
index 523ff04..4bf4906 100644 (file)
@@ -15,6 +15,7 @@ namespace TYPO3\CMS\Form\Utility;
  */
 
 use TYPO3\CMS\Form\Domain\Model\Json\AbstractJsonElement;
+use TYPO3\CMS\Form\ObjectFactory;
 
 /**
  * Typoscript to JSON converter
@@ -55,7 +56,7 @@ class TypoScriptToJsonConverter {
                $className = 'TYPO3\\CMS\\Form\\Domain\\Model\Json\\' . ucfirst($class) . 'JsonElement';
                $this->addValidationRules($arguments);
                /** @var $object AbstractJsonElement */
-               $object = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance($className);
+               $object = ObjectFactory::createFormObject($className);
                $object->setParameters($arguments);
                if ($object->childElementsAllowed()) {
                        $this->getChildElementsByIntegerKey($object, $arguments);
index ca5f695..6156631 100644 (file)
@@ -15,6 +15,7 @@ namespace TYPO3\CMS\Form\Utility;
  */
 
 use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Form\ObjectFactory;
 use TYPO3\CMS\Form\Validation\AbstractValidator;
 
 /**
@@ -71,7 +72,7 @@ class ValidatorUtility implements \TYPO3\CMS\Core\SingletonInterface {
        public function createRule($class, $arguments = array()) {
                $class = strtolower((string)$class);
                $className = 'TYPO3\\CMS\\Form\\Validation\\' . ucfirst($class) . 'Validator';
-               $rule = GeneralUtility::makeInstance($className, $arguments);
+               $rule = ObjectFactory::createFormObject($className, $arguments);
                return $rule;
        }
 
index 1bec207..b22308c 100644 (file)
@@ -62,8 +62,7 @@ class AlphabeticValidator extends \TYPO3\CMS\Form\Validation\AbstractValidator {
                if ($this->requestHandler->has($this->fieldName)) {
                        $value = $this->requestHandler->getByMethod($this->fieldName);
                        if ($this->filter === NULL) {
-                               $className = \TYPO3\CMS\Form\Filter\AlphabeticFilter::class;
-                               $this->filter = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance($className);
+                               $this->filter = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Form\Filter\AlphabeticFilter::class);
                        }
                        $this->filter->setAllowWhiteSpace($this->allowWhiteSpace);
                        if ($this->filter->filter($value) !== $value) {
index 75016d8..2254692 100644 (file)
@@ -60,8 +60,7 @@ class AlphanumericValidator extends \TYPO3\CMS\Form\Validation\AbstractValidator
                if ($this->requestHandler->has($this->fieldName)) {
                        $value = $this->requestHandler->getByMethod($this->fieldName);
                        if ($this->filter === NULL) {
-                               $className = \TYPO3\CMS\Form\Filter\AlphanumericFilter::class;
-                               $this->filter = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance($className);
+                               $this->filter = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Form\Filter\AlphanumericFilter::class);
                        }
                        $this->filter->setAllowWhiteSpace($this->allowWhiteSpace);
                        if ($this->filter->filter($value) !== $value) {
index f053347..a1b43f7 100644 (file)
@@ -43,8 +43,7 @@ class DigitValidator extends \TYPO3\CMS\Form\Validation\AbstractValidator {
                if ($this->requestHandler->has($this->fieldName)) {
                        $value = $this->requestHandler->getByMethod($this->fieldName);
                        if ($this->filter === NULL) {
-                               $className = \TYPO3\CMS\Form\Filter\DigitFilter::class;
-                               $this->filter = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance($className);
+                               $this->filter = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Form\Filter\DigitFilter::class);
                        }
                        if ($this->filter->filter($value) !== $value) {
                                return FALSE;
index 76daf58..745a875 100644 (file)
@@ -16,6 +16,7 @@ namespace TYPO3\CMS\Form\View\Confirmation\Element;
 
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Form\Domain\Model\Element\AbstractElement;
+use TYPO3\CMS\Form\ObjectFactory;
 use TYPO3\CMS\Form\Utility\FormUtility;
 
 /**
@@ -286,7 +287,7 @@ abstract class AbstractElementView {
        protected function createAdditional($class) {
                $class = strtolower((string)$class);
                $className = 'TYPO3\\CMS\\Form\\View\\Confirmation\\Additional\\' . ucfirst($class) . 'AdditionalElementView';
-               return GeneralUtility::makeInstance($className, $this->model);
+               return ObjectFactory::createFormObject($className, $this->model);
        }
 
        /**
index 4d61b08..e8ae70c 100644 (file)
@@ -15,6 +15,7 @@ namespace TYPO3\CMS\Form\View\Confirmation\Element;
  */
 
 use TYPO3\CMS\Form\Domain\Model\Element\AbstractElement;
+use TYPO3\CMS\Form\ObjectFactory;
 
 /**
  * Abstract class for the form element containers (FORM and FIELDSET) view
@@ -78,7 +79,7 @@ class ContainerElementView extends \TYPO3\CMS\Form\View\Confirmation\Element\Abs
                $class = \TYPO3\CMS\Form\Utility\FormUtility::getInstance()->getLastPartOfClassName($modelChild);
                $className = 'TYPO3\\CMS\\Form\\View\\Confirmation\\Element\\' . ucfirst($class) . 'ElementView';
                if (class_exists($className)) {
-                       $childElement = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance($className, $modelChild);
+                       $childElement = ObjectFactory::createFormObject($className, $modelChild);
                }
                return $childElement;
        }
index c7f1c65..12185e1 100644 (file)
@@ -16,6 +16,7 @@ namespace TYPO3\CMS\Form\View\Form\Element;
 
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Form\Domain\Model\Element\AbstractElement;
+use TYPO3\CMS\Form\ObjectFactory;
 use TYPO3\CMS\Form\Utility\FormUtility;
 
 /**
@@ -338,7 +339,7 @@ abstract class AbstractElementView {
        protected function createAdditional($class) {
                $class = strtolower((string)$class);
                $className = 'TYPO3\\CMS\\Form\\View\\Form\\Additional\\' . ucfirst($class) . 'AdditionalElementView';
-               return GeneralUtility::makeInstance($className, $this->model);
+               return ObjectFactory::createFormObject($className, $this->model);
        }
 
        /**
index 92b62f7..21c7809 100644 (file)
@@ -14,6 +14,7 @@ namespace TYPO3\CMS\Form\View\Form\Element;
  * The TYPO3 project - inspiring people to share!
  */
 use TYPO3\CMS\Form\Domain\Model\Element\AbstractElement;
+use TYPO3\CMS\Form\ObjectFactory;
 
 /**
  * Abstract class for the form element containers (FORM and FIELDSET) view
@@ -73,7 +74,7 @@ class ContainerElementView extends \TYPO3\CMS\Form\View\Form\Element\AbstractEle
                $class = \TYPO3\CMS\Form\Utility\FormUtility::getInstance()->getLastPartOfClassName($modelChild);
                $className = 'TYPO3\\CMS\\Form\\View\\Form\\Element\\' . ucfirst($class) . 'ElementView';
                if (class_exists($className)) {
-                       $childElement = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance($className, $modelChild);
+                       $childElement = ObjectFactory::createFormObject($className, $modelChild);
                }
                return $childElement;
        }
index f1110e3..3f40a2c 100644 (file)
@@ -16,6 +16,7 @@ namespace TYPO3\CMS\Form\View\Mail\Html\Element;
 
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Form\Domain\Model\Element\AbstractElement;
+use TYPO3\CMS\Form\ObjectFactory;
 use TYPO3\CMS\Form\View\Mail\Html\Additional\AdditionalElementView;
 
 /**
@@ -284,7 +285,7 @@ abstract class AbstractElementView {
        protected function createAdditional($class) {
                $class = strtolower((string)$class);
                $className = 'TYPO3\\CMS\\Form\\View\\Mail\\Html\\Additional\\' . ucfirst($class) . 'AdditionalElementView';
-               return GeneralUtility::makeInstance($className, $this->model);
+               return ObjectFactory::createFormObject($className, $this->model);
        }
 
        /**
index cc479e4..fe9e911 100644 (file)
@@ -13,6 +13,7 @@ namespace TYPO3\CMS\Form\View\Mail\Html\Element;
  *
  * The TYPO3 project - inspiring people to share!
  */
+use TYPO3\CMS\Form\ObjectFactory;
 use TYPO3\CMS\Form\View\Mail\Html\Additional\AdditionalElementView;
 
 /**
@@ -77,7 +78,7 @@ class ContainerElementView extends \TYPO3\CMS\Form\View\Mail\Html\Element\Abstra
                $class = \TYPO3\CMS\Form\Utility\FormUtility::getInstance()->getLastPartOfClassName($modelChild);
                $className = 'TYPO3\\CMS\\Form\\View\\Mail\\Html\\Element\\' . ucfirst($class) . 'ElementView';
                if (class_exists($className)) {
-                       $childElement = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance($className, $modelChild);
+                       $childElement = ObjectFactory::createFormObject($className, $modelChild);
                }
                return $childElement;
        }
index 5335222..a4772b6 100644 (file)
@@ -13,6 +13,7 @@ namespace TYPO3\CMS\Form\View\Mail\Plain\Element;
  *
  * The TYPO3 project - inspiring people to share!
  */
+use TYPO3\CMS\Form\ObjectFactory;
 
 /**
  * Main view layer for plain mail container content.
@@ -46,7 +47,7 @@ class ContainerElementView extends \TYPO3\CMS\Form\View\Mail\Plain\Element\Abstr
                $className = 'TYPO3\\CMS\\Form\\View\\Mail\\Plain\\Element\\' . ucfirst($class) . 'ElementView';
                if (class_exists($className)) {
                        /** @var $childElement \TYPO3\CMS\Form\View\Mail\Plain\Element\AbstractElementView */
-                       $childElement = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance($className, $modelChild, $spaces);
+                       $childElement = ObjectFactory::createFormObject($className, $modelChild, $spaces);
                        $elementContent = $childElement->render();
                        if ($elementContent != '') {
                                $content = $childElement->render() . LF;
diff --git a/typo3/sysext/form/Migrations/Code/ClassAliasMap.php b/typo3/sysext/form/Migrations/Code/ClassAliasMap.php
deleted file mode 100644 (file)
index 488bdc3..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-<?php
-return array(
-       'TYPO3\\CMS\\Form\\Domain\\Model\\Attribute\\AcceptcharsetAttribute' => \TYPO3\CMS\Form\Domain\Model\Attribute\AcceptCharsetAttribute::class,
-       'TYPO3\\CMS\\Form\\Domain\\Model\\Element\\CheckboxgroupElement' => \TYPO3\CMS\Form\Domain\Model\Element\CheckboxGroupElement::class,
-       'TYPO3\\CMS\\Form\\Domain\\Model\\Element\\RadiogroupElement' => \TYPO3\CMS\Form\Domain\Model\Element\RadioGroupElement::class,
-       'TYPO3\\CMS\\Form\\Domain\\Model\\Json\\CheckboxgroupJsonElement' => \TYPO3\CMS\Form\Domain\Model\Json\CheckboxGroupJsonElement::class,
-       'TYPO3\\CMS\\Form\\Domain\\Model\\Json\\RadiogroupJsonElement' => \TYPO3\CMS\Form\Domain\Model\Json\RadioGroupJsonElement::class,
-       'TYPO3\\CMS\\Form\\Filter\\RegexpFilter' => \TYPO3\CMS\Form\Filter\RegExpFilter::class,
-       'TYPO3\\CMS\\Form\\Filter\\StripnewlinesFilter' => \TYPO3\CMS\Form\Filter\StripNewLinesFilter::class,
-       'TYPO3\\CMS\\Form\\Filter\\TitlecaseFilter' => \TYPO3\CMS\Form\Filter\TitleCaseFilter::class,
-       'TYPO3\\CMS\\Form\\Filter\\UppercaseFilter' => \TYPO3\CMS\Form\Filter\UpperCaseFilter::class,
-       'TYPO3\\CMS\\Form\\Validation\\FileallowedtypesValidator' => \TYPO3\CMS\Form\Validation\FileAllowedTypesValidator::class,
-       'TYPO3\\CMS\\Form\\Validation\\FilemaximumsizeValidator' => \TYPO3\CMS\Form\Validation\FileMaximumSizeValidator::class,
-       'TYPO3\\CMS\\Form\\Validation\\FileminimumsizeValidator' => \TYPO3\CMS\Form\Validation\FileMinimumSizeValidator::class,
-       'TYPO3\\CMS\\Form\\Validation\\GreaterthanValidator' => \TYPO3\CMS\Form\Validation\GreaterThanValidator::class,
-       'TYPO3\\CMS\\Form\\Validation\\InarrayValidator' => \TYPO3\CMS\Form\Validation\InArrayValidator::class,
-       'TYPO3\\CMS\\Form\\Validation\\RegexpValidator' => \TYPO3\CMS\Form\Validation\RegExpValidator::class,
-       'TYPO3\\CMS\\Form\\View\\Confirmation\\Element\\CheckboxgroupElementView' => \TYPO3\CMS\Form\View\Confirmation\Element\CheckboxGroupElementView::class,
-       'TYPO3\\CMS\\Form\\View\\Confirmation\\Element\\RadiogroupElementView' => \TYPO3\CMS\Form\View\Confirmation\Element\RadioGroupElementView::class,
-       'TYPO3\\CMS\\Form\\View\\Form\\Element\\CheckboxgroupElementView' => \TYPO3\CMS\Form\View\Form\Element\CheckboxGroupElementView::class,
-       'TYPO3\\CMS\\Form\\View\\Form\\Element\\RadiogroupElementView' => \TYPO3\CMS\Form\View\Form\Element\RadioGroupElementView::class,
-       'TYPO3\\CMS\\Form\\View\\Mail\\Html\\Element\\CheckboxgroupElementView' => \TYPO3\CMS\Form\View\Mail\Html\Element\CheckboxGroupElementView::class,
-       'TYPO3\\CMS\\Form\\View\\Mail\\Html\\Element\\RadiogroupElementView' => \TYPO3\CMS\Form\View\Mail\Html\Element\RadioGroupElementView::class,
-       'TYPO3\\CMS\\Form\\View\\Mail\\Plain\\Element\\CheckboxgroupElementView' => \TYPO3\CMS\Form\View\Mail\Plain\Element\CheckboxGroupElementView::class,
-       'TYPO3\\CMS\\Form\\View\\Mail\\Plain\\Element\\RadiogroupElementView' => \TYPO3\CMS\Form\View\Mail\Plain\Element\RadioGroupElementView::class,
-       'TYPO3\\CMS\\Form\\Filter\\RemovexssFilter' => \TYPO3\CMS\Form\Filter\RemoveXssFilter::class,
-);
\ No newline at end of file
index 17796c5..9582e64 100644 (file)
                        "Package": {
                                "partOfFactoryDefault": true
                        }
-               },
-               "class-alias-maps": [
-                       "Migrations/Code/ClassAliasMap.php"
-               ]
+               }
        },
        "autoload": {
                "psr-4": {