| Conditions | 6 |
| Paths | 6 |
| Total Lines | 31 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 12 | public function shouldRedirect( |
||
| 13 | Request $request, |
||
| 14 | AdminConfiguration $configuration, |
||
| 15 | AdminInterface $admin, |
||
| 16 | ActionInterface $action, |
||
| 17 | string $formName = '' |
||
| 18 | ) { |
||
| 19 | if (!$this->isFormValid($admin, $configuration, $formName)) { |
||
| 20 | return false; |
||
| 21 | } |
||
| 22 | |||
| 23 | // When the create form is submitted, the user should be redirected to the edit action after saving the form |
||
| 24 | // data |
||
| 25 | if ('create' === $action->getName()) { |
||
| 26 | return true; |
||
| 27 | } |
||
| 28 | |||
| 29 | // When the delete form is submitted, we should redirect to the list action |
||
| 30 | if ('delete' === $action->getName()) { |
||
| 31 | return true; |
||
| 32 | } |
||
| 33 | |||
| 34 | if (!$request->get('submit_and_redirect')) { |
||
| 35 | return false; |
||
| 36 | } |
||
| 37 | |||
| 38 | if ('submit_and_redirect' !== $request->get('submit_and_redirect')) { |
||
| 39 | return false; |
||
| 40 | } |
||
| 41 | |||
| 42 | return true; |
||
| 43 | } |
||
| 67 |