infoweb\cms\controllers\ImageController::actionRemoveImage PHP Метод

actionRemoveImage() публичный Метод

Removes a specific image from the model
public actionRemoveImage ( ) : string
Результат string JSON response
    public function actionRemoveImage()
    {
        // Default response
        $response = ['status' => 1, 'msg' => ''];
        $post = Yii::$app->request->post();
        if (isset($post['model']) && !empty($post['model'])) {
            /// Load model
            $model = Yii::createObject(['class' => $post['model'], 'id' => $post['modelId']]);
            // Remove the image
            $model->removeImageByIdentifier($post['identifier']);
        }
        // Return validation in JSON format
        Yii::$app->response->format = Response::FORMAT_JSON;
        return $response;
    }
ImageController