@@ 266-268 (lines=3) @@ | ||
263 | ||
264 | if ($id !== null) { |
|
265 | $field = Field::find()->where(['id' => $id])->one(); |
|
266 | if ($field === null) { |
|
267 | return ['success' => false, 'message' => Yii::t('app', 'No such field')]; |
|
268 | } |
|
269 | } else { |
|
270 | $field = new Field(); |
|
271 | } |
|
@@ 296-298 (lines=3) @@ | ||
293 | Yii::$app->response->format = \yii\web\Response::FORMAT_JSON; |
|
294 | ||
295 | $field = Field::find()->where(['id' => $id])->with('contentTypes')->one(); |
|
296 | if ($field === null || $field->delete() === false) { |
|
297 | return ['success' => false, 'message' => Yii::t('app', 'Deletion failed')]; |
|
298 | } |
|
299 | ||
300 | return ['success' => true]; |
|
301 | } |