Closure finisher
The "Closure finisher" can only be used within forms that are created programmatically. It allows you to execute your own finisher code without implementing/ declaring a finisher.
Table of contents
Important
Finishers are executed in the order defined in your form definition.
Options of the closure finisher
closure
-
- Type
?\
Closure - Required
true
- Default
null
The name of the field as shown in the form.
Using the closure finisher programmatically
This finisher can only be used in programmatically-created forms. It makes it possible to execute one's own finisher code without having to implement/ declare this finisher.
Usage through code:
<?php
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Form\Domain\Finishers\ClosureFinisher;
use TYPO3\CMS\Form\Domain\Model\FormDefinition;
class SomeClass
{
private function addClosureFinisher(FormDefinition $formDefinition)
{
$closureFinisher = GeneralUtility::makeInstance(ClosureFinisher::class);
$closureFinisher->setOption('closure', function ($finisherContext)
{
$formRuntime = $finisherContext->getFormRuntime();
// ...
});
$formDefinition->addFinisher($closureFinisher);
}
}
This finisher is implemented in
\TYPO3\
.