Skip to content

Instantly share code, notes, and snippets.

@bwaidelich
Created March 28, 2012 15:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bwaidelich/2227439 to your computer and use it in GitHub Desktop.
Save bwaidelich/2227439 to your computer and use it in GitHub Desktop.
Closure Finisher
<?php
// ...
$closureFinisher = new \TYPO3\Form\Finishers\ClosureFinisher();
$closureFinisher->setOption('closure', function($formRuntime) {
// $formRuntime->getFormState()->getFormValues();
});
$formDefinition->addFinisher($closureFinisher);
// ...
?>
@farconada
Copy link

where could I get the $formRuntime. Inside the formFactory?

$redirectFinisher->setOptions(
            array('action' => 'confirmation',
               'arguments' => array (
                   'fieldNombre' => 'XXXX some value in the form XXXX'
               )

            )
        );

could I add any key to $factorySpecificConfiguration ? for example

<form:render factoryClass="TYPO3\FormExample\ExampleFormFactories\TestFactory" overrideConfiguration="{redirectTo: 'myAction'}"/>
public function build(array $factorySpecificConfiguration, $presetName)

@farconada
Copy link

Reutilization of the person object created by the form in several finishers

class TestFactory extends \TYPO3\Form\Factory\AbstractFormFactory {

    /**
     * @param array $factorySpecificConfiguration
     * @param $presetName
     * @return \TYPO3\Form\Core\Model\FormDefinition
     */
    public function build(array $factorySpecificConfiguration, $presetName) {
        $formPersistenceManager = new \TYPO3\Form\Persistence\YamlPersistenceManager();
        $formConfiguration = $formPersistenceManager->load('prueba');

        $arrayFormFactory = new \TYPO3\Form\Factory\ArrayFormFactory();

        $form = $arrayFormFactory->build($formConfiguration,$presetName);
        $redirectFinisher = new \TYPO3\Form\Finishers\RedirectFinisher();
        //idea code beguin
        $personObject = objectbuilder($form->getFormRuntime()->getFormSubmittedValues())
        $redirectFinisher->setOptions(
            array('action' => 'confirmation',
               'arguments' => array (
                   'Person' => $personObjecy
               )

            )
        );
       $otherFinisher->setOptions('person' => $personObject);

      // idea code end
        $form->addFinisher($redirectFinisher);
        return $form;
    }
}
?>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment