---
title: "Closure finisher"
manual: "Form"
version: "main"
permalink: "https://docs.typo3.org/permalink/typo3/cms-form:concepts-finishers-closurefinisher@main"
source: "I/Concepts/Finishers/ReadyToUseFinishers/ClosureFinisher/Index.rst"
rendered: "2026-09-19T16:47:20+00:00"
---

# Closure finisher {#concepts-finishers-closurefinisher}

The "Closure finisher" can only be used in programmatically-created forms. It allows
you to execute your own finisher code without implementing/ declaring a finisher.

**Table of contents**

-   [Closure finisher option](https://docs.typo3.org/permalink/typo3/cms-form:closure-finisher-option@main)
-   [Using the closure finisher programmatically](https://docs.typo3.org/permalink/typo3/cms-form:using-the-closure-finisher-programmatically@main)

> [!IMPORTANT]
> Finishers are executed in the order defined in your form definition.
>
> See [Finisher execution order](https://docs.typo3.org/permalink/typo3/cms-form:concepts-finishers-execution-order@main).

## Closure finisher option {#apireference-finisheroptions-closurefinisher-options}

-   **closure**

    -   *Type:* `?Closure`
    -   *Required:* true
    -   *Default:* `null`

    The name of the field as shown in the form.

## Using the closure finisher programmatically {#apireference-finisheroptions-closurefinisher}

This finisher can only be used in programmatically-created forms. It allows
you to execute your own finisher code without implementing/ declaring a finisher.

Code example:

```php
<?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\CMS\Form\Domain\Finishers\ClosureFinisher`.
