/**
  * {@inheritDoc}
  */
 public function getFormOptions($step, array $options = array())
 {
     $options = parent::getFormOptions($step, $options);
     $options['cascade_validation'] = true;
     $options['flowStep'] = $step;
     return $options;
 }
Beispiel #2
0
 public function getFormOptions($step, array $options = array())
 {
     $options = parent::getFormOptions($step, $options);
     $options['cascade_validation'] = true;
     $options['data_class'] = 'VirtualniNemocnice\\AppBundle\\Document\\Question';
     return $options;
 }
 /**
  * {@inheritDoc}
  */
 public function getFormOptions($step, array $options = array())
 {
     $options = parent::getFormOptions($step, $options);
     if ($step === 3) {
         $options['isBugReport'] = $this->getFormData()->isBugReport();
     }
     return $options;
 }
 /**
  * {@inheritDoc}
  */
 public function getFormOptions($step, array $options = array())
 {
     $options = parent::getFormOptions($step, $options);
     $options['cascade_validation'] = true;
     $options['flowStep'] = $step;
     if ($step === 3) {
         $options['isBugReport'] = $this->getFormData()->isBugReport();
     }
     return $options;
 }
 protected function processFlow($formData, FormFlow $flow)
 {
     $flow->bind($formData);
     $form = $flow->createForm();
     if ($flow->isValid($form)) {
         $flow->saveCurrentStepData($form);
         if ($flow->nextStep()) {
             // create form for next step
             $form = $flow->createForm();
         } else {
             // flow finished
             $flow->reset();
             return new JsonResponse($formData);
         }
     }
     return array('form' => $form->createView(), 'flow' => $flow, 'formData' => $formData);
 }
 /**
  * @param FormFlow $flow The flow involved.
  * @param integer $stepNumber Number of the step the link will be generated for.
  * @return boolean If the step can be linked to.
  */
 public function isStepLinkable(FormFlow $flow, $stepNumber)
 {
     if (!$flow->isAllowDynamicStepNavigation() || $flow->getCurrentStepNumber() === $stepNumber || $flow->isStepSkipped($stepNumber)) {
         return false;
     }
     $lastStepConsecutivelyDone = 0;
     for ($i = $flow->getFirstStepNumber(), $lastStepNumber = $flow->getLastStepNumber(); $i < $lastStepNumber; ++$i) {
         if ($flow->isStepDone($i)) {
             $lastStepConsecutivelyDone = $i;
         } else {
             break;
         }
     }
     $lastStepLinkable = $lastStepConsecutivelyDone + 1;
     if ($stepNumber <= $lastStepLinkable) {
         return true;
     }
     return false;
 }
 /**
  * {@inheritDoc}
  */
 public function bind($formData)
 {
     $this->dataManager->getStorage()->set($this->getCalledEventsSessionKey(), array());
     parent::bind($formData);
 }
 public function setEventDispatcher(EventDispatcherInterface $dispatcher)
 {
     parent::setEventDispatcher($dispatcher);
     $dispatcher->addSubscriber($this);
 }
 /**
  * Removes the parameter for dynamic step navigation.
  * @param array $parameters Current route parameters.
  * @param FormFlow $flow The flow involved.
  * @return array Route parameters without the step parameter.
  */
 public function removeDynamicStepNavigationParameter(array $parameters, FormFlow $flow)
 {
     unset($parameters[$flow->getDynamicStepNavigationParameter()]);
     return $parameters;
 }
 protected function processFlow($formData, FormFlow $flow, $template = 'IntegrationTestBundle::layout_flow.html.twig')
 {
     $flow->bind($formData);
     $form = $submittedForm = $flow->createForm();
     if ($flow->isValid($submittedForm)) {
         $flow->saveCurrentStepData($submittedForm);
         if ($flow->nextStep()) {
             // create form for next step
             $form = $flow->createForm();
         } else {
             // flow finished
             $flow->reset();
             return new JsonResponse($formData);
         }
     }
     if ($flow->redirectAfterSubmit($submittedForm)) {
         $request = $this->getCurrentRequest();
         $params = $this->get('craue_formflow_util')->addRouteParameters(array_merge($request->query->all(), $request->attributes->get('_route_params')), $flow);
         return $this->redirect($this->generateUrl($request->attributes->get('_route'), $params));
     }
     return $this->render($template, array('form' => $form->createView(), 'flow' => $flow, 'formData' => $formData));
 }
 /**
  * Removes route parameters for dynamic step navigation.
  * @param array $parameters Current route parameters.
  * @param FormFlow $flow The flow involved.
  * @return array Route parameters without instance and step parameter.
  */
 public function removeRouteParameters(array $parameters, FormFlow $flow)
 {
     unset($parameters[$flow->getDynamicStepNavigationInstanceParameter()]);
     unset($parameters[$flow->getDynamicStepNavigationStepParameter()]);
     return $parameters;
 }