From 3f36c7b8f7fcea71047452bb1e3cd58f2cd8d82e Mon Sep 17 00:00:00 2001
From: Stefan Galinski <stefan@sgalinski.de>
Date: Wed, 28 Nov 2018 19:15:29 +0100
Subject: [PATCH] =?UTF-8?q?[BUGFIX]=20Fix=20writing=20of=20the=20form=20co?=
 =?UTF-8?q?nfigurations=20if=20the=20folder=20is=20=E1=B8=BFissing,=20Fix?=
 =?UTF-8?q?=20default=20form=20extension=20key=20to=20project=5Ftheme?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 Classes/Finisher/Forms/FormsFinisher.php     |  2 +-
 Classes/Service/RegisterService.php          | 13 +++----------
 Classes/XClass/Form/FormEditorController.php | 12 ++++--------
 3 files changed, 8 insertions(+), 19 deletions(-)

diff --git a/Classes/Finisher/Forms/FormsFinisher.php b/Classes/Finisher/Forms/FormsFinisher.php
index 1d2765ae..965d5a55 100644
--- a/Classes/Finisher/Forms/FormsFinisher.php
+++ b/Classes/Finisher/Forms/FormsFinisher.php
@@ -96,7 +96,7 @@ class FormsFinisher extends AbstractFinisher {
 
 		$objectManager = GeneralUtility::makeInstance(ObjectManager::class);
 		$mailTemplateService = $objectManager->get(
-			MailTemplateService::class, $templateName, 'sg_mail', $markers
+			MailTemplateService::class, $templateName, 'project_theme', $markers
 		);
 
 		$ignoreMailQueue = (boolean) $this->parseOption('ignoreMailQueue');
diff --git a/Classes/Service/RegisterService.php b/Classes/Service/RegisterService.php
index 80d7dec1..6533ad9d 100644
--- a/Classes/Service/RegisterService.php
+++ b/Classes/Service/RegisterService.php
@@ -249,15 +249,9 @@ class RegisterService implements \TYPO3\CMS\Core\SingletonInterface {
 		// get the location where registrations should be stored
 		$configurationLocation = $this->getRegistrationPath();
 
-		$registerFolder = GeneralUtility::getFileAbsFileName(
-			$configurationLocation
-		);
-		// create folder
-		GeneralUtility::mkdir($registerFolder);
-
-		$registerFile = GeneralUtility::getFileAbsFileName(
-			$registerFolder . '/' . $templateKey . '.php'
-		);
+		$registerFolder = GeneralUtility::getFileAbsFileName($configurationLocation);
+		GeneralUtility::mkdir_deep($registerFolder);
+		$registerFile = GeneralUtility::getFileAbsFileName($registerFolder . '/' . $templateKey . '.php');
 
 		// build the register array
 		$newRegisterArray = [
@@ -282,4 +276,3 @@ class RegisterService implements \TYPO3\CMS\Core\SingletonInterface {
 		file_put_contents($registerFile, '<?php return ' . var_export($newRegisterArray, TRUE) . ';');
 	}
 }
-
diff --git a/Classes/XClass/Form/FormEditorController.php b/Classes/XClass/Form/FormEditorController.php
index d3c2e53b..0e5d631d 100644
--- a/Classes/XClass/Form/FormEditorController.php
+++ b/Classes/XClass/Form/FormEditorController.php
@@ -91,7 +91,7 @@ class FormEditorController extends \TYPO3\CMS\Form\Controller\FormEditorControll
 
 			// retrieve the extension and template key and jump out of loop
 			$extensionKey = (string) $finisher['options']['extension'];
-			$extensionKey = $extensionKey ?: 'sg_mail';
+			$extensionKey = $extensionKey ?: 'project_theme';
 			$templateKey = str_replace('_', '-', $finisher['options']['template']);
 
 			// if no template key was explicitly set, use the form identifier as template key
@@ -163,12 +163,8 @@ class FormEditorController extends \TYPO3\CMS\Form\Controller\FormEditorControll
 	private function writeRegisterFile(array $renderables, $extensionKey, $templateKey): string {
 		// get the location where automatic registrations should be stored
 		$configurationLocation = $this->getRegistrationPath();
-
-		$registerFolder = GeneralUtility::getFileAbsFileName(
-			$configurationLocation
-		);
-
-		GeneralUtility::mkdir($registerFolder);
+		$registerFolder = GeneralUtility::getFileAbsFileName($configurationLocation);
+		GeneralUtility::mkdir_deep($registerFolder);
 
 		$hashPrefix = md5($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'] . '|' . $templateKey . '.php');
 		$registerFile = GeneralUtility::getFileAbsFileName(
@@ -186,8 +182,8 @@ class FormEditorController extends \TYPO3\CMS\Form\Controller\FormEditorControll
 
 		// add the markers for this template
 		foreach ($renderables as $element) {
-			$markerName = $element['identifier'];
 			// if markerName is explicitly set, override the registered identifier
+			$markerName = $element['identifier'];
 			if (isset($element['properties']['markerName']) && $element['properties']['markerName'] !== '') {
 				$markerName = $element['properties']['markerName'];
 			}
-- 
GitLab