2 declare(strict_types = 1);
26 use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
27 use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
28 use TYPO3Fluid\Fluid\Core\ViewHelper\Traits\CompileWithRenderStatic;
47 use CompileWithRenderStatic;
61 $this->registerArgument(
'persistenceIdentifier',
'string',
'The persistence identifier for the form.',
false,
null);
62 $this->registerArgument(
'factoryClass',
'string',
'The fully qualified class name of the factory',
false, ArrayFormFactory::class);
63 $this->registerArgument(
'prototypeName',
'string',
'Name of the prototype to use',
false,
null);
64 $this->registerArgument(
'overrideConfiguration',
'array',
'factory specific configuration',
false, []);
73 public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
75 $persistenceIdentifier = $arguments[
'persistenceIdentifier'];
76 $factoryClass = $arguments[
'factoryClass'];
77 $prototypeName = $arguments[
'prototypeName'];
78 $overrideConfiguration = $arguments[
'overrideConfiguration'];
80 $objectManager = GeneralUtility::makeInstance(ObjectManager::class);
81 if (!empty($persistenceIdentifier)) {
82 $formPersistenceManager = $objectManager->get(FormPersistenceManagerInterface::class);
83 $formConfiguration = $formPersistenceManager->load($persistenceIdentifier);
86 $overrideConfiguration
88 $overrideConfiguration = $formConfiguration;
89 $overrideConfiguration[
'persistenceIdentifier'] = $persistenceIdentifier;
92 if (empty($prototypeName)) {
93 $prototypeName = $overrideConfiguration[
'prototypeName'] ??
'standard';
96 $factory = $objectManager->get($factoryClass);
97 $formDefinition = $factory->build($overrideConfiguration, $prototypeName);
98 $response = $renderingContext->getControllerContext()->getResponse() ?? $objectManager->get(Response::class);
99 $form = $formDefinition->bind($renderingContext->getControllerContext()->getRequest(), $response);
104 if ($renderingContext->getControllerContext()->getResponse() ===
null) {
106 return $form->render();
107 }
catch (\
TYPO3\CMS\
Extbase\Mvc\Exception\StopActionException $exception) {
108 return $response->shutdown();
112 return $form->render();