get_response_html() public method

This does not take the submitted form element into account.
See also: MC4WP_Form_Element::get_response_html()
public get_response_html ( ) : string
return string
 /**
  * Get HTML to be added _after_ the HTML of the form fields.
  *
  * @return string
  */
 protected function get_html_after_fields()
 {
     $html = '';
     $form = $this->form;
     /**
      * Filters the HTML after the form fields.
      *
      * @param string $html
      * @param MC4WP_Form $form
      */
     $html = (string) apply_filters('mc4wp_form_after_fields', $html, $form);
     if ($this->get_response_position() === 'after') {
         $html = $this->form->get_response_html($this->is_submitted) . $html;
     }
     return $html;
 }
Beispiel #2
0
 /**
  * Returns the form response
  *
  * @return string
  */
 public function get_form_response()
 {
     return $this->form->get_response_html();
 }
 /**
  * @param MC4WP_Form $form
  */
 public function respond_to_request(MC4WP_Form $form)
 {
     // do nothing if we're not doing AJAX
     if (!defined('DOING_AJAX') || !DOING_AJAX) {
         return;
     }
     // clear output, some plugins might have thrown errors by now.
     if (ob_get_level() > 0) {
         ob_end_clean();
     }
     // Format response using Google JSON Style Guide: https://google.github.io/styleguide/jsoncstyleguide.xml
     $response = array();
     // error
     if ($form->has_errors()) {
         $response['error'] = array('type' => $form->errors[0], 'message' => $form->get_response_html(), 'errors' => $form->errors);
         wp_send_json($response);
         exit;
     }
     // success
     $response['data'] = array('event' => $form->get_action() . 'd', 'message' => $form->get_response_html(), 'hide_fields' => (bool) $form->settings['hide_after_success']);
     if ($form->get_redirect_url()) {
         $response['data']['redirect_to'] = $form->get_redirect_url();
     }
     wp_send_json($response);
     exit;
 }