public function actionUpdate($id)
    {
        $module = MediaModule::getInstance();
        if (!is_null($module->adminLayout)) {
            $this->layout = $module->adminLayout;
        }

        $model = $this->findModel($id);
        $model->title = $model->id;
        $controllerName = $this->getUniqueId();

        $meta['title'] = $this->pageTitle;
        $meta['description'] = 'Update media';
        $meta['pageIcon'] = $this->pageIcon;

        if ($model->load(Yii::$app->request->post()) && $model->save()) {
            Yii::$app->session->setFlash('success', 'Media has been updated');
            return $this->redirect(Url::previous());
        } else {
            return $this->render('update', [
                'model' => $model,
                'meta' => $meta,
                'controllerName' => $controllerName,
            ]);
        }
    }
public function actionUpdate($id)
    {
        $module = MediaModule::getInstance();
        if (!is_null($module->adminLayout)) {
            $this->layout = $module->adminLayout;
        }

        $model = $this->findModel($id);
        $model->title = $model->id;
        $controllerName = $this->getUniqueId();

        $meta['title'] = $this->pageTitle;
        $meta['description'] = 'Update media';
        $meta['pageIcon'] = $this->pageIcon;

        if ($model->load(Yii::$app->request->post()) && $model->save()) {
            Yii::$app->session->setFlash('success', 'Media has been updated');
            return $this->redirect(Url::previous());
        } else {
            return $this->render('update', [
                'model' => $model,
                'meta' => $meta,
                'controllerName' => $controllerName,
            ]);
        }
    }
public function actionUpdate ( $ id ) { $ module = MediaModule :: getInstance ( ) ; if ( ! is_null ( $ module -> adminLayout ) ) { $ this -> layout = $ module -> adminLayout ; } $ model = $ this -> findModel ( $ id ) ; $ model -> title = $ model -> id ; $ controllerName = $ this -> getUniqueId ( ) ; $ meta [ 'title' ] = $ this -> pageTitle ; $ meta [ 'description' ] = 'Update media' ; $ meta [ 'pageIcon' ] = $ this -> pageIcon ; if ( $ model -> load ( Yii :: $ app -> request -> post ( ) ) && $ model -> save ( ) ) { Yii :: $ app -> session -> setFlash ( 'success' , 'Media has been updated' ) ; return $ this -> redirect ( Url :: previous ( ) ) ; } else { return $ this -> render ( 'update' , [ 'model' => $ model , 'meta' => $ meta , 'controllerName' => $ controllerName , ] ) ; } }
Updates an existing Media model.
If update is successful, the browser will be redirected to the 'view' page.
@param string $id
@return mixed
Updates an existing Media model . If update is successful the browser will be redirected to the view page .