/** * Edit and add content items * @param int|null $id * @return string * @throws \Ffcms\Core\Exception\SyntaxException * @throws \Ffcms\Core\Exception\NativeException */ public function actionUpdate($id = null) { // get item with trashed objects $record = ContentEntity::withTrashed()->findOrNew($id); $isNew = $record->id === null; // init model $model = new FormContentUpdate($record); // check if model is submit if ($model->send() && $model->validate()) { $model->save(); if ($isNew === true) { $this->response->redirect('content/index'); } App::$Session->getFlashBag()->add('success', __('Content is successful updated')); } // draw response return $this->view->render('content_update', ['model' => $model]); }