/** * Creates and edits a template * * @param int $id optional template id to edit. If not provided a new template will be created */ public function actionEdit($id = 0) { $model = TemplateEditor::getModel($id); if (TemplateEditor::save($model)) { Yii::$app->getSession()->setFlash('success', Yii::t('cms', 'Template saved.')); if (Yii::$app->toolbar->stayAfterSave()) { return $this->redirect(['edit', 'id' => $model->id]); } else { return $this->redirect(['index']); } } $layouts = Yii::$app->big->getFrontendThemeLayouts(); return $this->render('edit', ['model' => $model, 'layouts' => $layouts]); }