[TASK] Show speaking exception message if form definition is invalid 87/57487/3
authorRalf Zimmermann <ralf.zimmermann@tritum.de>
Fri, 22 Jun 2018 23:46:48 +0000 (01:46 +0200)
committerAnja Leichsenring <aleichsenring@ab-softlab.de>
Sun, 5 Aug 2018 13:23:59 +0000 (15:23 +0200)
Show a speaking exception message within the frontend if the
form definition is invalid.

Change-Id: Ifcb0684c9b5136c5dee5ac6b54732fcde02d82cf
Releases: master, 8.7
Resolves: #85357
Reviewed-on: https://review.typo3.org/57487
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
typo3/sysext/form/Classes/Domain/Factory/ArrayFormFactory.php

index c9f16ad..21d8072 100644 (file)
@@ -21,6 +21,7 @@ use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Extbase\Object\ObjectManager;
 use TYPO3\CMS\Form\Domain\Configuration\ConfigurationService;
 use TYPO3\CMS\Form\Domain\Exception\IdentifierNotValidException;
+use TYPO3\CMS\Form\Domain\Exception\RenderingException;
 use TYPO3\CMS\Form\Domain\Exception\UnknownCompositRenderableException;
 use TYPO3\CMS\Form\Domain\Model\FormDefinition;
 use TYPO3\CMS\Form\Domain\Model\FormElements\AbstractSection;
@@ -40,6 +41,7 @@ class ArrayFormFactory extends AbstractFormFactory
      * @param array $configuration
      * @param string $prototypeName
      * @return FormDefinition
+     * @throws RenderingException
      * @internal
      */
     public function build(array $configuration, string $prototypeName = null): FormDefinition
@@ -49,6 +51,10 @@ class ArrayFormFactory extends AbstractFormFactory
         }
         $persistenceIdentifier = (isset($configuration['persistenceIdentifier'])) ? $configuration['persistenceIdentifier'] : null;
 
+        if ($configuration['invalid'] === true) {
+            throw new RenderingException($configuration['label'], 1529710560);
+        }
+
         $prototypeConfiguration = GeneralUtility::makeInstance(ObjectManager::class)
             ->get(ConfigurationService::class)
             ->getPrototypeConfiguration($prototypeName);