public function actionDelete($id) { // Find Model $model = BlockService::findById($id); // Delete/Render if exist if (isset($model)) { if ($model->load(Yii::$app->request->post(), 'Block')) { if (BlockService::delete($model)) { $this->redirect(['all']); } } $banner = $model->banner; $video = $model->video; $texture = $model->texture; $templatesMap = TemplateService::getIdNameMap(['conditions' => ['type' => CmsGlobal::TYPE_BLOCK], 'prepend' => [['name' => '0', 'value' => 'Choose Template']]]); return $this->render('delete', ['model' => $model, 'banner' => $banner, 'video' => $video, 'texture' => $texture, 'templatesMap' => $templatesMap]); } // Model not found throw new NotFoundHttpException(Yii::$app->cmgCoreMessage->getMessage(CoreGlobal::ERROR_NOT_FOUND)); }
public function actionSettings($id) { // Find Model $model = WidgetService::findById($id); // Update/Render if exist if (isset($model)) { $meta = new WidgetForm($model->data); if ($meta->load(Yii::$app->request->post(), 'WidgetForm')) { if (WidgetService::update($model, $meta)) { return $this->redirect(['all']); } } $templatesMap = TemplateService::getIdNameMap(CmsGlobal::TYPE_WIDGET); return $this->render('settings', ['model' => $model, 'meta' => $meta, 'templatesMap' => $templatesMap]); } // Model not found throw new NotFoundHttpException(Yii::$app->cmgCoreMessage->getMessage(CoreGlobal::ERROR_NOT_FOUND)); }