diff --git a/Classes/XClass/Form/FormEditorController.php b/Classes/XClass/Form/FormEditorController.php index 25e95417d1e472e35c3b3207c6ab91f6b38a2cf7..5331d901d8fe7a3e291a0be63c5e9c667175c682 100644 --- a/Classes/XClass/Form/FormEditorController.php +++ b/Classes/XClass/Form/FormEditorController.php @@ -135,11 +135,11 @@ class FormEditorController extends \TYPO3\CMS\Form\Controller\FormEditorControll } } - // write the new Register.php file - $this->writeRegisterFile($renderables, $extensionKey, $templateKey); - // call register function in register service class $registrationService = GeneralUtility::makeInstance(RegisterService::class); + // write the new Register.php file and add it to the registrationFiles array in the RegisterService + $registerFilePath = $this->writeRegisterFile($renderables, $extensionKey, $templateKey); + $registrationService->register($registerFilePath); $registrationService->registerExtensions(); // clear caches @@ -152,8 +152,9 @@ class FormEditorController extends \TYPO3\CMS\Form\Controller\FormEditorControll * @param array $renderables * @param string $extensionKey * @param string $templateKey + * @return string */ - private function writeRegisterFile(array $renderables, $extensionKey, $templateKey) { + private function writeRegisterFile(array $renderables, $extensionKey, $templateKey): string { // get the location where automatic registrations should be stored $configurationLocation = $this->getRegistrationPath(); @@ -163,8 +164,9 @@ class FormEditorController extends \TYPO3\CMS\Form\Controller\FormEditorControll // create folder GeneralUtility::mkdir($registerFolder); + $hashPrefix = md5($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'] . '|' . $templateKey . '.php'); $registerFile = GeneralUtility::getFileAbsFileName( - $registerFolder . '/' . $templateKey . '.php' + $registerFolder . '/' . $hashPrefix . '_' . $templateKey . '.php' ); // build the register array @@ -193,6 +195,8 @@ class FormEditorController extends \TYPO3\CMS\Form\Controller\FormEditorControll } file_put_contents($registerFile, '<?php return ' . var_export($newRegisterArray, TRUE) . ';'); + + return $registerFile; } /**