/** * Get HTML one fields in one form * * @param \WP_REST_Request $request Full data about the request. * @return \WP_Error|\WP_REST_Response */ public function get_field($request) { $form = $this->get_form($request); if (is_wp_error($form)) { return $form; } if (!isset($form->data['fields'][$request->get_param('field')])) { return new \WP_Error('invalid_form_field', __('Invalid Form ID', 'caldera-forms')); } $field = \Caldera_Forms::render_field($form->data['fields'][$request->get_param('field')], $form->data); return new \WP_REST_Response($field, 200); }