‪TYPO3CMS  ‪main
FormEditorController.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
5 /*
6  * This file is part of the TYPO3 CMS project.
7  *
8  * It is free software; you can redistribute it and/or modify it under
9  * the terms of the GNU General Public License, either version 2
10  * of the License, or any later version.
11  *
12  * For the full copyright and license information, please read the
13  * LICENSE.txt file that was distributed with this source code.
14  *
15  * The TYPO3 project - inspiring people to share!
16  */
17 
19 
20 use Psr\Http\Message\ResponseInterface;
27 use TYPO3\CMS\Core\Imaging\IconSize;
47 
55 {
56  protected const ‪JS_MODULE_NAMES = ['app', 'mediator', 'viewModel'];
57 
58  protected array ‪$prototypeConfiguration;
59 
60  public function ‪__construct(
61  protected readonly ‪ModuleTemplateFactory $moduleTemplateFactory,
62  protected readonly ‪PageRenderer $pageRenderer,
63  protected readonly ‪IconFactory $iconFactory,
64  protected readonly ‪FormDefinitionConversionService $formDefinitionConversionService,
65  ) {}
66 
72  public function ‪indexAction(string $formPersistenceIdentifier, ?string $prototypeName = null): ResponseInterface
73  {
74  if (!$this->formPersistenceManager->isAllowedPersistencePath($formPersistenceIdentifier)) {
75  throw new ‪PersistenceManagerException(sprintf('Read "%s" is not allowed', $formPersistenceIdentifier), 1614500662);
76  }
77 
78  if (
79  ‪PathUtility::isExtensionPath($formPersistenceIdentifier)
80  && !$this->formSettings['persistenceManager']['allowSaveToExtensionPaths']
81  ) {
82  throw new ‪PersistenceManagerException('Edit an extension formDefinition is not allowed.', 1478265661);
83  }
84 
85  $configurationService = GeneralUtility::makeInstance(ConfigurationService::class);
86  $formDefinition = $this->formPersistenceManager->load($formPersistenceIdentifier);
87 
88  if ($prototypeName === null) {
89  $prototypeName = $formDefinition['prototypeName'] ?? 'standard';
90  } else {
91  // Loading a form definition with another prototype is currently not implemented but is planned in the future.
92  // This safety check is a preventive measure.
93  $selectablePrototypeNames = $configurationService->getSelectablePrototypeNamesDefinedInFormEditorSetup();
94  if (!in_array($prototypeName, $selectablePrototypeNames, true)) {
95  throw new ‪Exception(sprintf('The prototype name "%s" is not configured within "formManager.selectablePrototypesConfiguration" ', $prototypeName), 1528625039);
96  }
97  }
98 
99  $formDefinition['prototypeName'] = $prototypeName;
100  $this->prototypeConfiguration = $configurationService->getPrototypeConfiguration($prototypeName);
101 
102  $formDefinition = $this->‪transformFormDefinitionForFormEditor($formDefinition);
103  $formEditorDefinitions = $this->‪getFormEditorDefinitions();
104 
105  $additionalViewModelJavaScriptModules = array_map(
107  $this->prototypeConfiguration['formEditor']['dynamicJavaScriptModules']['additionalViewModelModules'] ?? []
108  );
109  array_map($this->pageRenderer->getJavaScriptRenderer()->addJavaScriptModuleInstruction(...), $additionalViewModelJavaScriptModules);
110  $formEditorAppInitialData = [
111  'formEditorDefinitions' => $formEditorDefinitions,
112  'formDefinition' => $formDefinition,
113  'formPersistenceIdentifier' => $formPersistenceIdentifier,
114  'prototypeName' => $prototypeName,
115  'endpoints' => [
116  'formPageRenderer' => $this->uriBuilder->uriFor('renderFormPage'),
117  'saveForm' => $this->uriBuilder->uriFor('saveForm'),
118  ],
119  'additionalViewModelModules' => $additionalViewModelJavaScriptModules,
120  'maximumUndoSteps' => $this->prototypeConfiguration['formEditor']['maximumUndoSteps'],
121  ];
122 
123  $moduleTemplate = $this->‪initializeModuleTemplate($this->request);
124  $moduleTemplate->assign('formEditorTemplates', $this->‪renderFormEditorTemplates($formEditorDefinitions));
125 
126  ‪$uriBuilder = GeneralUtility::makeInstance(UriBuilder::class);
127  $addInlineSettings = [
128  'FormEditor' => [
129  'typo3WinBrowserUrl' => (string)‪$uriBuilder->buildUriFromRoute('wizard_element_browser'),
130  ],
131  ];
132 
133  $addInlineSettings = array_replace_recursive(
134  $addInlineSettings,
135  $this->prototypeConfiguration['formEditor']['addInlineSettings']
136  );
137 
138  if (json_encode($formEditorAppInitialData) === false) {
139  throw new ‪Exception('The form editor app data could not be encoded', 1628677079);
140  }
141 
142  $javaScriptModules = array_map(
144  array_filter(
145  $this->prototypeConfiguration['formEditor']['dynamicJavaScriptModules'] ?? [],
146  fn(string ‪$name) => in_array(‪$name, self::JS_MODULE_NAMES, true),
147  ARRAY_FILTER_USE_KEY
148  )
149  );
150  $pageRenderer = $this->pageRenderer;
151  $pageRenderer->getJavaScriptRenderer()->addJavaScriptModuleInstruction(
152  ‪JavaScriptModuleInstruction::create('@typo3/form/backend/helper.js', 'Helper')
153  ->invoke('dispatchFormEditor', $javaScriptModules, $formEditorAppInitialData)
154  );
155  array_map($pageRenderer->getJavaScriptRenderer()->addJavaScriptModuleInstruction(...), $javaScriptModules);
156  $pageRenderer->addInlineSettingArray(null, $addInlineSettings);
157  $pageRenderer->addInlineLanguageLabelFile('EXT:form/Resources/Private/Language/locallang_formEditor_failSafeErrorHandling_javascript.xlf');
158  $stylesheets = $this->prototypeConfiguration['formEditor']['stylesheets'];
159  foreach ($stylesheets as $stylesheet) {
160  $pageRenderer->addCssFile($stylesheet);
161  }
162 
163  $moduleTemplate->setModuleClass($this->request->getPluginName() . '_' . $this->request->getControllerName());
164  $moduleTemplate->setFlashMessageQueue($this->‪getFlashMessageQueue());
165  $moduleTemplate->setTitle(
166  $this->‪getLanguageService()->sL('LLL:EXT:form/Resources/Private/Language/locallang_module.xlf:mlang_tabs_tab'),
167  $formDefinition['label']
168  );
169  return $moduleTemplate->renderResponse('Backend/FormEditor/Index');
170  }
171 
176  public function ‪initializeSaveFormAction(): void
177  {
178  $this->defaultViewObjectName = JsonView::class;
179  }
180 
184  public function ‪saveFormAction(string $formPersistenceIdentifier, ‪FormDefinitionArray $formDefinition): ResponseInterface
185  {
186  $formDefinition = $formDefinition->getArrayCopy();
187 
188  foreach (‪$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/form']['beforeFormSave'] ?? [] as $className) {
189  $hookObj = GeneralUtility::makeInstance($className);
190  if (method_exists($hookObj, 'beforeFormSave')) {
191  $formDefinition = $hookObj->beforeFormSave(
192  $formPersistenceIdentifier,
193  $formDefinition
194  );
195  }
196  }
197 
198  $response = [
199  'status' => 'success',
200  ];
201 
202  try {
203  if (!$this->formPersistenceManager->isAllowedPersistencePath($formPersistenceIdentifier)) {
204  throw new ‪PersistenceManagerException(sprintf('Save "%s" is not allowed', $formPersistenceIdentifier), 1614500663);
205  }
206  $this->formPersistenceManager->save($formPersistenceIdentifier, $formDefinition);
207  $configurationService = GeneralUtility::makeInstance(ConfigurationService::class);
208  $this->prototypeConfiguration = $configurationService->getPrototypeConfiguration($formDefinition['prototypeName']);
209  $formDefinition = $this->‪transformFormDefinitionForFormEditor($formDefinition);
210  $response['formDefinition'] = $formDefinition;
211  } catch (‪PersistenceManagerException $e) {
212  $response = [
213  'status' => 'error',
214  'message' => $e->getMessage(),
215  'code' => $e->getCode(),
216  ];
217  }
218 
219  $this->view->assign('response', $response);
220  // saveFormAction uses the extbase JsonView::class.
221  // That's why we have to set the view variables in this way.
222  $this->view->setVariablesToRender([
223  'response',
224  ]);
225 
226  return $this->‪jsonResponse();
227  }
228 
233  public function ‪renderFormPageAction(
234  ‪FormDefinitionArray $formDefinition,
235  int $pageIndex,
236  ?string $prototypeName = null
237  ): ResponseInterface {
238  $prototypeName = $prototypeName ?: $formDefinition['prototypeName'] ?? 'standard';
239  $formDefinition = $formDefinition->getArrayCopy();
240 
241  $formFactory = GeneralUtility::makeInstance(ArrayFormFactory::class);
242  $formDefinition = $formFactory->build($formDefinition, $prototypeName);
243  $formDefinition->setRenderingOption('previewMode', true);
244  $form = $formDefinition->bind($this->request);
245  $form->setCurrentSiteLanguage($this->‪buildFakeSiteLanguage(0, 0));
246  $form->overrideCurrentPage($pageIndex);
247 
248  return $this->‪htmlResponse($form->render());
249  }
250 
255  protected function ‪buildFakeSiteLanguage(int $pageId, int $languageId): ‪SiteLanguage
256  {
257  $fakeSiteConfiguration = [
258  'languages' => [
259  [
260  'languageId' => $languageId,
261  'title' => 'Dummy',
262  'navigationTitle' => '',
263  'flag' => '',
264  'locale' => '',
265  ],
266  ],
267  ];
268 
269  $currentSiteLanguage = GeneralUtility::makeInstance(Site::class, 'form-dummy', $pageId, $fakeSiteConfiguration)
270  ->getLanguageById($languageId);
271  return $currentSiteLanguage;
272  }
273 
278  protected function ‪getInsertRenderablesPanelConfiguration(array $formElementsDefinition): array
279  {
281  $formElementsByGroup = [];
282 
283  foreach ($formElementsDefinition as $formElementName => $formElementConfiguration) {
284  if (!isset($formElementConfiguration['group'])) {
285  continue;
286  }
287  if (!isset($formElementsByGroup[$formElementConfiguration['group']])) {
288  $formElementsByGroup[$formElementConfiguration['group']] = [];
289  }
290 
291  $formElementConfiguration = GeneralUtility::makeInstance(TranslationService::class)->translateValuesRecursive(
292  $formElementConfiguration,
293  $this->prototypeConfiguration['formEditor']['translationFiles'] ?? []
294  );
295 
296  $formElementsByGroup[$formElementConfiguration['group']][] = [
297  'key' => $formElementName,
298  'cssKey' => preg_replace('/[^a-z0-9]/', '-', strtolower($formElementName)),
299  'label' => $formElementConfiguration['label'],
300  'sorting' => $formElementConfiguration['groupSorting'],
301  'iconIdentifier' => $formElementConfiguration['iconIdentifier'],
302  ];
303  }
304 
305  $formGroups = [];
306  foreach ($this->prototypeConfiguration['formEditor']['formElementGroups'] ?? [] as $groupName => $groupConfiguration) {
307  if (!isset($formElementsByGroup[$groupName])) {
308  continue;
309  }
310 
311  usort($formElementsByGroup[$groupName], static function ($a, $b) {
312  return $a['sorting'] - $b['sorting'];
313  });
314 
315  $groupConfiguration = GeneralUtility::makeInstance(TranslationService::class)->translateValuesRecursive(
316  $groupConfiguration,
317  $this->prototypeConfiguration['formEditor']['translationFiles'] ?? []
318  );
319 
320  $formGroups[] = [
321  'key' => $groupName,
322  'elements' => $formElementsByGroup[$groupName],
323  'label' => $groupConfiguration['label'],
324  ];
325  }
326 
327  return $formGroups;
328  }
329 
333  protected function ‪getFormEditorDefinitions(): array
334  {
335  $formEditorDefinitions = [];
336  foreach ([$this->prototypeConfiguration, $this->prototypeConfiguration['formEditor']] as $configuration) {
337  foreach ($configuration as $firstLevelItemKey => $firstLevelItemValue) {
338  if (substr($firstLevelItemKey, -10) !== 'Definition') {
339  continue;
340  }
341  $reducedKey = substr($firstLevelItemKey, 0, -10);
342  foreach ($configuration[$firstLevelItemKey] as $formEditorDefinitionKey => $formEditorDefinitionValue) {
343  if (isset($formEditorDefinitionValue['formEditor'])) {
344  $formEditorDefinitionValue = array_intersect_key($formEditorDefinitionValue, array_flip(['formEditor']));
345  $formEditorDefinitions[$reducedKey][$formEditorDefinitionKey] = $formEditorDefinitionValue['formEditor'];
346  } else {
347  $formEditorDefinitions[$reducedKey][$formEditorDefinitionKey] = $formEditorDefinitionValue;
348  }
349  }
350  }
351  }
352  $formEditorDefinitions = ‪ArrayUtility::reIndexNumericArrayKeysRecursive($formEditorDefinitions);
353  $formEditorDefinitions = GeneralUtility::makeInstance(TranslationService::class)->translateValuesRecursive(
354  $formEditorDefinitions,
355  $this->prototypeConfiguration['formEditor']['translationFiles'] ?? []
356  );
357  return $formEditorDefinitions;
358  }
359 
364  {
365  $moduleTemplate = $this->moduleTemplateFactory->create(‪$request);
366 
367  $buttonBar = $moduleTemplate->‪getDocHeaderComponent()->getButtonBar();
368  $getVars = ‪$request->‪getArguments();
369 
370  if (isset($getVars['action']) && $getVars['action'] === 'index') {
371  $newPageButton = $buttonBar->makeInputButton()
372  ->setDataAttributes(['action' => 'formeditor-new-page', 'identifier' => 'headerNewPage'])
373  ->setTitle($this->‪getLanguageService()->sL('LLL:EXT:form/Resources/Private/Language/Database.xlf:formEditor.new_page_button'))
374  ->setName('formeditor-new-page')
375  ->setValue('new-page')
376  ->setClasses('t3-form-element-new-page-button hidden')
377  ->setIcon($this->iconFactory->getIcon('actions-page-new', IconSize::SMALL));
378 
379  ‪$uriBuilder = GeneralUtility::makeInstance(UriBuilder::class);
380 
381  $closeButton = $buttonBar->makeLinkButton()
382  ->setDataAttributes(['identifier' => 'closeButton'])
383  ->setHref((string)‪$uriBuilder->buildUriFromRoute('web_FormFormbuilder'))
384  ->setClasses('t3-form-element-close-form-button hidden')
385  ->setTitle($this->‪getLanguageService()->sL('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:rm.closeDoc'))
386  ->setShowLabelText(true)
387  ->setIcon($this->iconFactory->getIcon('actions-close', IconSize::SMALL));
388 
389  $saveButton = $buttonBar->makeInputButton()
390  ->setDataAttributes(['identifier' => 'saveButton'])
391  ->setTitle($this->‪getLanguageService()->sL('LLL:EXT:form/Resources/Private/Language/Database.xlf:formEditor.save_button'))
392  ->setName('formeditor-save-form')
393  ->setValue('save')
394  ->setClasses('t3-form-element-save-form-button hidden')
395  ->setIcon($this->iconFactory->getIcon('actions-document-save', IconSize::SMALL))
396  ->setShowLabelText(true);
397 
398  $formSettingsButton = $buttonBar->makeInputButton()
399  ->setDataAttributes(['identifier' => 'formSettingsButton'])
400  ->setTitle($this->‪getLanguageService()->sL('LLL:EXT:form/Resources/Private/Language/Database.xlf:formEditor.form_settings_button'))
401  ->setName('formeditor-form-settings')
402  ->setValue('settings')
403  ->setClasses('t3-form-element-form-settings-button hidden')
404  ->setIcon($this->iconFactory->getIcon('actions-system-extension-configure', IconSize::SMALL))
405  ->setShowLabelText(true);
406 
407  $undoButton = $buttonBar->makeInputButton()
408  ->setDataAttributes(['identifier' => 'undoButton'])
409  ->setTitle($this->‪getLanguageService()->sL('LLL:EXT:form/Resources/Private/Language/Database.xlf:formEditor.undo_button'))
410  ->setName('formeditor-undo-form')
411  ->setValue('undo')
412  ->setClasses('t3-form-element-undo-form-button hidden disabled')
413  ->setIcon($this->iconFactory->getIcon('actions-edit-undo', IconSize::SMALL));
414 
415  $redoButton = $buttonBar->makeInputButton()
416  ->setDataAttributes(['identifier' => 'redoButton'])
417  ->setTitle($this->‪getLanguageService()->sL('LLL:EXT:form/Resources/Private/Language/Database.xlf:formEditor.redo_button'))
418  ->setName('formeditor-redo-form')
419  ->setValue('redo')
420  ->setClasses('t3-form-element-redo-form-button hidden disabled')
421  ->setIcon($this->iconFactory->getIcon('actions-edit-redo', IconSize::SMALL));
422 
423  $buttonBar->addButton($newPageButton, ‪ButtonBar::BUTTON_POSITION_LEFT, 1);
424  $buttonBar->addButton($closeButton, ‪ButtonBar::BUTTON_POSITION_LEFT, 2);
425  $buttonBar->addButton($saveButton, ‪ButtonBar::BUTTON_POSITION_LEFT, 3);
426  $buttonBar->addButton($formSettingsButton, ‪ButtonBar::BUTTON_POSITION_LEFT, 4);
427  $buttonBar->addButton($undoButton, ‪ButtonBar::BUTTON_POSITION_LEFT, 5);
428  $buttonBar->addButton($redoButton, ‪ButtonBar::BUTTON_POSITION_LEFT, 5);
429  }
430 
431  return $moduleTemplate;
432  }
433 
437  protected function ‪renderFormEditorTemplates(array $formEditorDefinitions): string
438  {
439  $fluidConfiguration = $this->prototypeConfiguration['formEditor']['formEditorFluidConfiguration'] ?? null;
440  $formEditorPartials = $this->prototypeConfiguration['formEditor']['formEditorPartials'] ?? null;
441 
442  if (!isset($fluidConfiguration['templatePathAndFilename'])) {
443  throw new ‪RenderingException(
444  'The option templatePathAndFilename must be set.',
445  1485636499
446  );
447  }
448  if (
449  !isset($fluidConfiguration['layoutRootPaths'])
450  || !is_array($fluidConfiguration['layoutRootPaths'])
451  ) {
452  throw new ‪RenderingException(
453  'The option layoutRootPaths must be set.',
454  1480294721
455  );
456  }
457  if (
458  !isset($fluidConfiguration['partialRootPaths'])
459  || !is_array($fluidConfiguration['partialRootPaths'])
460  ) {
461  throw new ‪RenderingException(
462  'The option partialRootPaths must be set.',
463  1480294722
464  );
465  }
466 
467  $insertRenderablesPanelConfiguration = $this->‪getInsertRenderablesPanelConfiguration($formEditorDefinitions['formElements']);
468 
469  ‪$view = GeneralUtility::makeInstance(TemplateView::class);
470  ‪$view->getRenderingContext()->setRequest($this->request);
471  ‪$view->getRenderingContext()->getTemplatePaths()->fillFromConfigurationArray($fluidConfiguration);
472  ‪$view->setTemplatePathAndFilename($fluidConfiguration['templatePathAndFilename']);
473  ‪$view->assignMultiple([
474  'insertRenderablesPanelConfiguration' => $insertRenderablesPanelConfiguration,
475  'formEditorPartials' => $formEditorPartials,
476  ]);
477 
478  return ‪$view->render();
479  }
480 
484  protected function ‪transformFormDefinitionForFormEditor(array $formDefinition): array
485  {
487  $multiValueFormElementProperties = [];
489  $multiValueFinisherProperties = [];
490 
491  foreach ($this->prototypeConfiguration['formElementsDefinition'] as $type => $configuration) {
492  if (!isset($configuration['formEditor']['editors'])) {
493  continue;
494  }
495  foreach ($configuration['formEditor']['editors'] as $editorConfiguration) {
496  if (($editorConfiguration['templateName'] ?? '') === 'Inspector-PropertyGridEditor') {
497  $multiValueFormElementProperties[$type][] = $editorConfiguration['propertyPath'];
498  }
499  }
500  }
501 
502  foreach ($this->prototypeConfiguration['formElementsDefinition']['Form']['formEditor']['propertyCollections']['finishers'] ?? [] as $configuration) {
503  if (!isset($configuration['editors'])) {
504  continue;
505  }
506 
507  foreach ($configuration['editors'] as $editorConfiguration) {
508  if (($editorConfiguration['templateName'] ?? '') === 'Inspector-PropertyGridEditor') {
509  $multiValueFinisherProperties[$configuration['identifier']][] = $editorConfiguration['propertyPath'];
510  }
511  }
512  }
513 
514  $formDefinition = $this->‪filterEmptyArrays($formDefinition);
515  $formDefinition = $this->‪migrateEmailFinisherRecipients($formDefinition);
516 
517  // @todo: replace with rte parsing
518  $formDefinition = ArrayUtility::stripTagsFromValuesRecursive($formDefinition);
519  $formDefinition = $this->‪transformMultiValuePropertiesForFormEditor(
520  $formDefinition,
521  'type',
522  $multiValueFormElementProperties
523  );
524  $formDefinition = $this->‪transformMultiValuePropertiesForFormEditor(
525  $formDefinition,
526  'identifier',
527  $multiValueFinisherProperties
528  );
529 
530  $formDefinition = $this->formDefinitionConversionService->addHmacData($formDefinition);
531  $formDefinition = $this->formDefinitionConversionService->migrateFinisherConfiguration($formDefinition);
532 
533  return $formDefinition;
534  }
535 
569  array $formDefinition,
570  string $identifierProperty,
571  array $multiValueProperties
572  ): array {
573  $output = $formDefinition;
574  foreach ($formDefinition as $key => $value) {
575  ‪$identifier = $value[$identifierProperty] ?? null;
576 
577  if (is_string(‪$identifier) && array_key_exists(‪$identifier, $multiValueProperties)) {
578  $multiValuePropertiesForIdentifier = $multiValueProperties[‪$identifier];
579 
580  foreach ($multiValuePropertiesForIdentifier as $multiValueProperty) {
581  if (!‪ArrayUtility::isValidPath($value, $multiValueProperty, '.')) {
582  continue;
583  }
584 
585  $multiValuePropertyData = ‪ArrayUtility::getValueByPath($value, $multiValueProperty, '.');
586 
587  if (!is_array($multiValuePropertyData)) {
588  continue;
589  }
590 
591  $newMultiValuePropertyData = [];
592 
593  foreach ($multiValuePropertyData as $k => $v) {
594  $newMultiValuePropertyData[] = [
595  '_label' => $v,
596  '_value' => $k,
597  ];
598  }
599 
600  $value = ‪ArrayUtility::setValueByPath($value, $multiValueProperty, $newMultiValuePropertyData, '.');
601  }
602  }
603 
604  $output[$key] = $value;
605 
606  if (is_array($value)) {
607  $output[$key] = $this->‪transformMultiValuePropertiesForFormEditor(
608  $value,
609  $identifierProperty,
610  $multiValueProperties
611  );
612  }
613  }
614 
615  return $output;
616  }
617 
621  protected function ‪filterEmptyArrays(array $array): array
622  {
623  foreach ($array as $key => $value) {
624  if (!is_array($value)) {
625  continue;
626  }
627  if (empty($value)) {
628  unset($array[$key]);
629  continue;
630  }
631  $array[$key] = $this->‪filterEmptyArrays($value);
632  if (empty($array[$key])) {
633  unset($array[$key]);
634  }
635  }
636 
637  return $array;
638  }
639 
643  protected function ‪migrateEmailFinisherRecipients(array $formDefinition): array
644  {
645  foreach ($formDefinition['finishers'] ?? [] as $i => $finisherConfiguration) {
646  if (!in_array($finisherConfiguration['identifier'], ['EmailToSender', 'EmailToReceiver'], true)) {
647  continue;
648  }
649 
650  $recipientAddress = $finisherConfiguration['options']['recipientAddress'] ?? '';
651  $recipientName = $finisherConfiguration['options']['recipientName'] ?? '';
652  $carbonCopyAddress = $finisherConfiguration['options']['carbonCopyAddress'] ?? '';
653  $blindCarbonCopyAddress = $finisherConfiguration['options']['blindCarbonCopyAddress'] ?? '';
654  $replyToAddress = $finisherConfiguration['options']['replyToAddress'] ?? '';
655 
656  if (!empty($recipientAddress)) {
657  $finisherConfiguration['options']['recipients'][$recipientAddress] = $recipientName;
658  }
659 
660  if (!empty($carbonCopyAddress)) {
661  $finisherConfiguration['options']['carbonCopyRecipients'][$carbonCopyAddress] = '';
662  }
663 
664  if (!empty($blindCarbonCopyAddress)) {
665  $finisherConfiguration['options']['blindCarbonCopyRecipients'][$blindCarbonCopyAddress] = '';
666  }
667 
668  if (!empty($replyToAddress)) {
669  $finisherConfiguration['options']['replyToRecipients'][$replyToAddress] = '';
670  }
671 
672  unset(
673  $finisherConfiguration['options']['recipientAddress'],
674  $finisherConfiguration['options']['recipientName'],
675  $finisherConfiguration['options']['carbonCopyAddress'],
676  $finisherConfiguration['options']['blindCarbonCopyAddress'],
677  $finisherConfiguration['options']['replyToAddress']
678  );
679  $formDefinition['finishers'][$i] = $finisherConfiguration;
680  }
681 
682  return $formDefinition;
683  }
684 
686  {
687  return ‪$GLOBALS['BE_USER'];
688  }
689 
691  {
692  return ‪$GLOBALS['LANG'];
693  }
694 }
‪TYPO3\CMS\Form\Domain\Factory\ArrayFormFactory
Definition: ArrayFormFactory.php:42
‪TYPO3\CMS\Form\Controller\FormEditorController\indexAction
‪indexAction(string $formPersistenceIdentifier, ?string $prototypeName=null)
Definition: FormEditorController.php:72
‪TYPO3\CMS\Core\Utility\PathUtility\isExtensionPath
‪static isExtensionPath(string $path)
Definition: PathUtility.php:118
‪TYPO3\CMS\Core\Utility\PathUtility
Definition: PathUtility.php:27
‪TYPO3\CMS\Backend\Template\Components\ButtonBar\BUTTON_POSITION_LEFT
‪const BUTTON_POSITION_LEFT
Definition: ButtonBar.php:37
‪TYPO3\CMS\Backend\Template\Components\ButtonBar
Definition: ButtonBar.php:33
‪TYPO3\CMS\Form\Controller\FormEditorController
Definition: FormEditorController.php:55
‪TYPO3\CMS\Extbase\Mvc\Controller\ActionController\$request
‪RequestInterface $request
Definition: ActionController.php:106
‪TYPO3\CMS\Form\Service\TranslationService
Definition: TranslationService.php:48
‪TYPO3\CMS\Backend\Template\ModuleTemplateFactory
Definition: ModuleTemplateFactory.php:35
‪TYPO3\CMS\Form\Mvc\Persistence\Exception\PersistenceManagerException
Definition: PersistenceManagerException.php:27
‪TYPO3\CMS\Extbase\Mvc\Controller\ActionController\$view
‪ViewInterface $view
Definition: ActionController.php:82
‪TYPO3\CMS\Form\Domain\Configuration\FormDefinitionConversionService
Definition: FormDefinitionConversionService.php:35
‪TYPO3\CMS\Form\Controller\FormEditorController\renderFormPageAction
‪renderFormPageAction(FormDefinitionArray $formDefinition, int $pageIndex, ?string $prototypeName=null)
Definition: FormEditorController.php:233
‪TYPO3\CMS\Form\Controller
Definition: AbstractBackendController.php:18
‪TYPO3\CMS\Form\Controller\FormEditorController\transformMultiValuePropertiesForFormEditor
‪transformMultiValuePropertiesForFormEditor(array $formDefinition, string $identifierProperty, array $multiValueProperties)
Definition: FormEditorController.php:568
‪TYPO3\CMS\Core\Imaging\IconFactory
Definition: IconFactory.php:34
‪TYPO3\CMS\Core\Page\JavaScriptModuleInstruction
Definition: JavaScriptModuleInstruction.php:23
‪TYPO3\CMS\Core\Utility\ArrayUtility\isValidPath
‪static bool isValidPath(array $array, array|string $path, string $delimiter='/')
Definition: ArrayUtility.php:141
‪TYPO3\CMS\Extbase\Mvc\Controller\ActionController\htmlResponse
‪htmlResponse(?string $html=null)
Definition: ActionController.php:812
‪TYPO3\CMS\Extbase\Mvc\Controller\ActionController\jsonResponse
‪jsonResponse(?string $json=null)
Definition: ActionController.php:823
‪TYPO3\CMS\Fluid\View\TemplateView
Definition: TemplateView.php:22
‪TYPO3\CMS\Backend\Template\ModuleTemplate
Definition: ModuleTemplate.php:46
‪TYPO3\CMS\Extbase\Mvc\Controller\ActionController\getFlashMessageQueue
‪getFlashMessageQueue(?string $identifier=null)
Definition: ActionController.php:668
‪TYPO3\CMS\Core\Site\Entity\Site
Definition: Site.php:42
‪TYPO3\CMS\Core\Utility\ArrayUtility\getValueByPath
‪static getValueByPath(array $array, array|string $path, string $delimiter='/')
Definition: ArrayUtility.php:176
‪TYPO3\CMS\Form\Controller\FormEditorController\getBackendUser
‪getBackendUser()
Definition: FormEditorController.php:685
‪TYPO3\CMS\Core\Site\Entity\SiteLanguage
Definition: SiteLanguage.php:27
‪TYPO3\CMS\Form\Controller\FormEditorController\$prototypeConfiguration
‪array $prototypeConfiguration
Definition: FormEditorController.php:58
‪TYPO3\CMS\Core\Page\PageRenderer
Definition: PageRenderer.php:45
‪TYPO3\CMS\Form\Controller\FormEditorController\getInsertRenderablesPanelConfiguration
‪getInsertRenderablesPanelConfiguration(array $formElementsDefinition)
Definition: FormEditorController.php:278
‪TYPO3\CMS\Form\Exception
Definition: Exception.php:25
‪TYPO3\CMS\Form\Controller\FormEditorController\renderFormEditorTemplates
‪renderFormEditorTemplates(array $formEditorDefinitions)
Definition: FormEditorController.php:437
‪TYPO3\CMS\Form\Controller\FormEditorController\getFormEditorDefinitions
‪getFormEditorDefinitions()
Definition: FormEditorController.php:333
‪TYPO3\CMS\Backend\Routing\UriBuilder
Definition: UriBuilder.php:44
‪TYPO3\CMS\Form\Controller\FormEditorController\__construct
‪__construct(protected readonly ModuleTemplateFactory $moduleTemplateFactory, protected readonly PageRenderer $pageRenderer, protected readonly IconFactory $iconFactory, protected readonly FormDefinitionConversionService $formDefinitionConversionService,)
Definition: FormEditorController.php:60
‪$name
‪$name
Definition: phpIntegrityChecker.php:235
‪TYPO3\CMS\Form\Type\FormDefinitionArray
Definition: FormDefinitionArray.php:24
‪TYPO3\CMS\Core\Authentication\BackendUserAuthentication
Definition: BackendUserAuthentication.php:62
‪TYPO3\CMS\Form\Controller\FormEditorController\getLanguageService
‪getLanguageService()
Definition: FormEditorController.php:690
‪TYPO3\CMS\Form\Controller\FormEditorController\buildFakeSiteLanguage
‪buildFakeSiteLanguage(int $pageId, int $languageId)
Definition: FormEditorController.php:255
‪TYPO3\CMS\Form\Domain\Configuration\ConfigurationService
Definition: ConfigurationService.php:50
‪TYPO3\CMS\Extbase\Mvc\RequestInterface
Definition: RequestInterface.php:24
‪TYPO3\CMS\Backend\Template\ModuleTemplate\getDocHeaderComponent
‪getDocHeaderComponent()
Definition: ModuleTemplate.php:181
‪TYPO3\CMS\Form\Controller\FormEditorController\migrateEmailFinisherRecipients
‪migrateEmailFinisherRecipients(array $formDefinition)
Definition: FormEditorController.php:643
‪TYPO3\CMS\Core\Utility\ArrayUtility
Definition: ArrayUtility.php:26
‪$GLOBALS
‪$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['adminpanel']['modules']
Definition: ext_localconf.php:25
‪TYPO3\CMS\Core\Utility\ArrayUtility\reIndexNumericArrayKeysRecursive
‪static reIndexNumericArrayKeysRecursive(array $array)
Definition: ArrayUtility.php:204
‪TYPO3\CMS\Form\Controller\FormEditorController\saveFormAction
‪saveFormAction(string $formPersistenceIdentifier, FormDefinitionArray $formDefinition)
Definition: FormEditorController.php:184
‪TYPO3\CMS\Core\Utility\ArrayUtility\setValueByPath
‪static array setValueByPath(array $array, string|array|\ArrayAccess $path, mixed $value, string $delimiter='/')
Definition: ArrayUtility.php:261
‪TYPO3\CMS\Form\Domain\Exception\RenderingException
Definition: RenderingException.php:29
‪TYPO3\CMS\Core\Localization\LanguageService
Definition: LanguageService.php:46
‪TYPO3\CMS\Core\Page\JavaScriptModuleInstruction\create
‪static create(string $name, ?string $exportName=null)
Definition: JavaScriptModuleInstruction.php:47
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:52
‪TYPO3\CMS\Extbase\Mvc\Controller\ActionController\$uriBuilder
‪UriBuilder $uriBuilder
Definition: ActionController.php:107
‪TYPO3\CMS\Form\Controller\FormEditorController\initializeSaveFormAction
‪initializeSaveFormAction()
Definition: FormEditorController.php:176
‪TYPO3\CMS\Form\Controller\AbstractBackendController
Definition: AbstractBackendController.php:32
‪TYPO3\CMS\Form\Controller\FormEditorController\JS_MODULE_NAMES
‪const JS_MODULE_NAMES
Definition: FormEditorController.php:56
‪TYPO3\CMS\Extbase\Mvc\View\JsonView
Definition: JsonView.php:31
‪TYPO3\CMS\Extbase\Mvc\RequestInterface\getArguments
‪getArguments()
‪TYPO3\CMS\Webhooks\Message\$identifier
‪identifier readonly string $identifier
Definition: FileAddedMessage.php:37
‪TYPO3\CMS\Form\Controller\FormEditorController\transformFormDefinitionForFormEditor
‪transformFormDefinitionForFormEditor(array $formDefinition)
Definition: FormEditorController.php:484
‪TYPO3\CMS\Form\Controller\FormEditorController\filterEmptyArrays
‪filterEmptyArrays(array $array)
Definition: FormEditorController.php:621
‪TYPO3\CMS\Form\Controller\FormEditorController\initializeModuleTemplate
‪initializeModuleTemplate(RequestInterface $request)
Definition: FormEditorController.php:363