/** * Deletes existing images. * If deletion is successful, the gridview will be refreshed. * @param string $id * @return mixed */ public function actionMultipleDelete() { // @todo $ids as param in action? $data['status'] = 0; Yii::$app->response->format = Response::FORMAT_JSON; if (Yii::$app->request->isAjax) { $ids = Yii::$app->request->post('ids'); Image::deleteAll(['id' => $ids]); $data['message'] = Yii::t('app', '{n, plural, =1{Image} other{# images}} successfully deleted', ['n' => count($ids)]); $data['status'] = 1; } return $data; }