public function actionDelete($id) { if ($_POST['action'] == 1) { $model = Field::find($id); $model->delete(); echo json_encode(array('id' => array($id), 'class' => 'alert-success', 'message' => __('delete success'))); exit; } }
/** * 内容类型 下的字段信息 */ static function tree($name) { $model = Field::find(array('slug' => $name)); if (!$model) { exit(__('form builder error')); } $models = Field::find()->where(array('pid' => $model->id))->all(); foreach ($models as $m) { $n = $m->slug; $out[$n]['slug'] = $m->slug; $out[$n]['name'] = $m->name; $out[$n]['fid'] = $m->id; $out[$n]['widget'] = $m->widget; $out[$n]['mysql'] = \app\modules\content\Hook::run($m->widget, 'mysql'); } return $out; }