Conditions | 3 |
Paths | 3 |
Total Lines | 19 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
26 | public function settings(): ?string |
||
27 | { |
||
28 | // init model with config array data |
||
29 | $model = new FormSettings($this->getConfigs()); |
||
|
|||
30 | |||
31 | // check if form is submited |
||
32 | if ($model->send()) { |
||
33 | if ($model->validate()) { |
||
34 | $this->setConfigs($model->getAllProperties()); |
||
35 | App::$Session->getFlashBag()->add('success', __('Settings is successful updated')); |
||
36 | $this->response->redirect('content/index'); |
||
37 | } else { |
||
38 | App::$Session->getFlashBag()->add('error', __('Form validation is failed')); |
||
39 | } |
||
40 | } |
||
41 | |||
42 | // render response |
||
43 | return $this->view->render('content/settings', [ |
||
44 | 'model' => $model |
||
45 | ]); |
||
47 | } |