1212use solutionDrive \MultiStepBundle \Context \FlowContext ;
1313use solutionDrive \MultiStepBundle \Context \FlowContextInterface ;
1414use solutionDrive \MultiStepBundle \Exception \NoNextOrPreviousStepException ;
15- use solutionDrive \MultiStepBundle \Model \MultiStepFlowInterface ;
1615use solutionDrive \MultiStepBundle \Model \MultiStepInterface ;
1716use solutionDrive \MultiStepBundle \Router \MultistepRouterInterface ;
1817use Symfony \Bundle \FrameworkBundle \Controller \Controller ;
@@ -33,14 +32,6 @@ class DefaultStepController extends Controller implements TemplateAwareControlle
3332
3433 public function renderAction (Request $ request ): Response
3534 {
36- // Enable simple navigation
37- if ('next ' === $ request ->get ('navigate_to_direction ' )) {
38- return $ this ->redirectToNextStep ();
39- } elseif ('previous ' === $ request ->get ('navigate_to_direction ' )) {
40- return $ this ->redirectToPreviousStep ();
41- }
42-
43- // Render template for current step
4435 return $ this ->render ($ this ->getTemplate (), $ this ->getTemplateVariables ());
4536 }
4637
@@ -53,12 +44,8 @@ public function renderAction(Request $request): Response
5344 public function getTemplateVariables (): array
5445 {
5546 return [
56- 'flow ' => $ this ->getFlow (),
57- 'step ' => $ this ->getStep (),
58- 'hasNextStep ' => $ this ->hasNextStep (),
59- 'hasPreviousStep ' => $ this ->hasPreviousStep (),
60- 'nextStepLink ' => $ this ->getNextStepLink (),
61- 'previousStepLink ' => $ this ->getPreviousStepLink (),
47+ 'flow ' => $ this ->flowContext ->getFlow (),
48+ 'step ' => $ this ->flowContext ->getCurrentStep (),
6249 ];
6350 }
6451
@@ -88,22 +75,6 @@ protected function redirectToStep(MultiStepInterface $step, int $statusCode): Re
8875 return $ this ->redirect ($ this ->router ->generateStepLink ($ step ), $ statusCode );
8976 }
9077
91- /**
92- * Returns true if there is a next step in the flow.
93- */
94- public function hasNextStep (): bool
95- {
96- return $ this ->flowContext ->hasNextStep ();
97- }
98-
99- /**
100- * Returns true if there is a previous step in the flow.
101- */
102- public function hasPreviousStep (): bool
103- {
104- return $ this ->flowContext ->hasPreviousStep ();
105- }
106-
10778 /**
10879 * Returns the configured template.
10980 * Can be overriden in step definition, see README.md for details.
@@ -131,26 +102,6 @@ public function getPreviousStep(): ?MultiStepInterface
131102 return $ this ->flowContext ->getPreviousStep ();
132103 }
133104
134- public function getNextStepLink (): ?string
135- {
136- return $ this ->hasNextStep () ? $ this ->router ->generateStepLink ($ this ->getNextStep ()) : null ;
137- }
138-
139- public function getPreviousStepLink (): ?string
140- {
141- return $ this ->hasPreviousStep () ? $ this ->router ->generateStepLink ($ this ->getPreviousStep ()) : null ;
142- }
143-
144- public function getFlow (): MultiStepFlowInterface
145- {
146- return $ this ->flowContext ->getFlow ();
147- }
148-
149- public function getStep (): ?MultiStepInterface
150- {
151- return $ this ->flowContext ->getCurrentStep ();
152- }
153-
154105 public function getFlowContext (): FlowContextInterface
155106 {
156107 return $ this ->flowContext ;
0 commit comments