/**
* @param integer $step
* @return void
* @Flow\SkipCsrfProtection
*/
public function indexAction($step = 0)
{
$this->currentStepIndex = $step;
$this->checkRequestedStepIndex();
$currentStep = $this->instantiateCurrentStep();
$controller = $this;
$callback = function (\Neos\Form\Core\Model\FinisherContext $finisherContext) use($controller, $currentStep) {
$controller->postProcessStep($finisherContext->getFormValues(), $currentStep);
};
$formDefinition = $currentStep->getFormDefinition($callback);
if ($this->currentStepIndex > 0) {
$formDefinition->setRenderingOption('previousStepUri', $this->uriBuilder->uriFor('index', ['step' => $this->currentStepIndex - 1]));
}
if ($currentStep->isOptional()) {
$formDefinition->setRenderingOption('nextStepUri', $this->uriBuilder->uriFor('index', ['step' => $this->currentStepIndex + 1]));
}
$totalAmountOfSteps = count($this->settings['steps']);
if ($this->currentStepIndex === $totalAmountOfSteps - 1) {
$formDefinition->setRenderingOption('finalStep', true);
$this->authenticationManager->logout();
}
$response = new \Neos\Flow\Http\Response($this->response);
$form = $formDefinition->bind($this->request, $response);
try {
$renderedForm = $form->render();
} catch (\Neos\Setup\Exception $exception) {
$this->addFlashMessage($exception->getMessage(), 'Exception while executing setup step', \Neos\Error\Messages\Message::SEVERITY_ERROR);
$this->redirect('index', null, null, ['step' => $this->currentStepIndex]);
}
$this->view->assignMultiple(['form' => $renderedForm, 'totalAmountOfSteps' => $totalAmountOfSteps, 'currentStepNumber' => $this->currentStepIndex + 1]);
}