Created
January 10, 2022 13:40
-
-
Save lorenzulrich/1609fc403711f5c53d50fd5d529029a2 to your computer and use it in GitHub Desktop.
Neos Form Builder Confirmation Finisher with Fluid
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Visol\FoobarCom\Form\Finishers; | |
use Neos\Flow\Annotations as Flow; | |
use Neos\FluidAdaptor\View\StandaloneView; | |
use Neos\Form\Core\Model\AbstractFinisher; | |
use Neos\Form\Exception\FinisherException; | |
use Neos\Utility\ObjectAccess; | |
class ConfirmationFinisher extends AbstractFinisher | |
{ | |
/** | |
* Executes this finisher | |
* @see AbstractFinisher::execute() | |
* | |
* @return void | |
* @throws FinisherException | |
* @throws \Neos\FluidAdaptor\Exception | |
*/ | |
protected function executeInternal() | |
{ | |
$formRuntime = $this->finisherContext->getFormRuntime(); | |
$standaloneView = $this->initializeStandaloneView(); | |
$standaloneView->assign('form', $formRuntime); | |
$referrer = $formRuntime->getRequest()->getHttpRequest()->getUri(); | |
$standaloneView->assign('referrer', $referrer); | |
$message = $standaloneView->render(); | |
$formRuntime->getResponse()->setContent($message); | |
} | |
/** | |
* @return StandaloneView | |
* @throws FinisherException | |
* @throws \Neos\FluidAdaptor\Exception | |
*/ | |
protected function initializeStandaloneView() | |
{ | |
$standaloneView = new StandaloneView(); | |
$standaloneView->setTemplateSource($messageDedodedGt); | |
$standaloneView->assign('formValues', $this->finisherContext->getFormValues()); | |
if (isset($this->options['variables'])) { | |
$standaloneView->assignMultiple($this->options['variables']); | |
} | |
return $standaloneView; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment