Commit ae2e9ad024c9020e31fee51b7eb889cdd0fdfd80
1 parent
a6942fb2
tile fix
Showing
1 changed file
with
28 additions
and
0 deletions
Show diff stats
backend/controllers/TileController.php
| @@ -11,6 +11,34 @@ use yii\web\NotFoundHttpException; | @@ -11,6 +11,34 @@ use yii\web\NotFoundHttpException; | ||
| 11 | class TileController extends Controller | 11 | class TileController extends Controller |
| 12 | { | 12 | { |
| 13 | /** | 13 | /** |
| 14 | + * Updates an existing Tile model. | ||
| 15 | + * If update is successful, the browser will be redirected to the 'view' page. | ||
| 16 | + * @param integer $id | ||
| 17 | + * @return mixed | ||
| 18 | + */ | ||
| 19 | + public function actionUpdate($id) | ||
| 20 | + { | ||
| 21 | + $model = $this->findModel($id); | ||
| 22 | + $model->generateLangs(); | ||
| 23 | + | ||
| 24 | + if ($model->loadWithLangs(\Yii::$app->request)) { | ||
| 25 | + | ||
| 26 | + if ($model->saveWithLangs()) { | ||
| 27 | + | ||
| 28 | + return $this->redirect( | ||
| 29 | + [ | ||
| 30 | + 'view', | ||
| 31 | + 'id' => $model->id, | ||
| 32 | + ] | ||
| 33 | + ); | ||
| 34 | + } | ||
| 35 | + } | ||
| 36 | + return $this->render('update', [ | ||
| 37 | + 'model' => $model, | ||
| 38 | + 'modelLangs' => $model->modelLangs, | ||
| 39 | + ]); | ||
| 40 | + } | ||
| 41 | + /** | ||
| 14 | * Lists all Tile models. | 42 | * Lists all Tile models. |
| 15 | * @return mixed | 43 | * @return mixed |
| 16 | */ | 44 | */ |