diff --git a/Form/FormFlow.php b/Form/FormFlow.php index e742f69d..a2dd34b5 100644 --- a/Form/FormFlow.php +++ b/Form/FormFlow.php @@ -163,6 +163,13 @@ abstract class FormFlow implements FormFlowInterface { */ private $expired = false; + + /** + * Flow was determined to be expired on post. + * @var boolean + */ + private $expiresOnRequest = true; + /** * Instance ID was a newly generated ID. * @var boolean @@ -639,7 +646,7 @@ protected function bindFlow() { $reset = true; } - if (in_array($this->getRequest()->getMethod(), array('POST', 'PUT')) && !$this->dataManager->exists($this)) { + if ($this->expiresOnRequest && (in_array($this->getRequest()->getMethod(), array('POST', 'PUT')) && !$this->dataManager->exists($this))) { // flow is expired, drop posted data and reset $this->getRequest()->request->replace(); $reset = true; @@ -972,6 +979,14 @@ public function createStepsFromConfig(array $stepsConfig) { return $steps; } + /** + * @param $expires + */ + public function expiresOnRequest($expires) + { + $this->expiresOnRequest = $expires; + } + /** * Defines the configuration for all steps of this flow. * @return array diff --git a/Form/FormFlowInterface.php b/Form/FormFlowInterface.php index 4c9f0648..208e31af 100644 --- a/Form/FormFlowInterface.php +++ b/Form/FormFlowInterface.php @@ -178,4 +178,9 @@ function getSteps(); */ function getStepCount(); + /** + * Toggles expiration on request + * @param $expires + */ + function expiresOnRequest($expires); }