public function put_forms($data, $form_id = null) { $this->authorize("gravityforms_create_form"); if (empty($form_id)) { $result = GFAPI::update_forms($data); } else { $result = GFAPI::update_form($data, $form_id); } if (is_wp_error($result)) { $response = $this->get_error_response($result); $status = $this->get_error_status($result); } else { $status = 200; $response = empty($form_id) ? __("Forms updated successfully", "gravityforms") : __("Form updated successfully", "gravityforms"); } $this->end($status, $response); }
public function put_forms($data, $form_id = null) { $this->log_debug(__METHOD__ . '(): Running.'); $capability = apply_filters('gform_web_api_capability_put_forms', 'gravityforms_create_form'); $this->authorize($capability); if (empty($form_id)) { $result = GFAPI::update_forms($data); } else { $result = GFAPI::update_form($data, $form_id); } if (is_wp_error($result)) { $response = $this->get_error_response($result); $status = $this->get_error_status($result); } else { $status = 200; $response = empty($form_id) ? __('Forms updated successfully', 'gravityforms') : __('Form updated successfully', 'gravityforms'); } $this->end($status, $response); }