Skip to content

Instantly share code, notes, and snippets.

@lorenzulrich
Created January 10, 2022 13: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 lorenzulrich/1609fc403711f5c53d50fd5d529029a2 to your computer and use it in GitHub Desktop.
Save lorenzulrich/1609fc403711f5c53d50fd5d529029a2 to your computer and use it in GitHub Desktop.
Neos Form Builder Confirmation Finisher with Fluid
<?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