GravityView  2.17
The best, easiest way to display Gravity Forms entries on your website.
Public Member Functions | Static Public Member Functions | Private Member Functions
GravityView_Ajax Class Reference

Public Member Functions

 __construct ()
 
 check_ajax_nonce ()
 --—— AJAX ----—— More...
 
 create_preset_form ()
 Create the preset form requested before the View save. More...
 
 get_active_areas ()
 Returns template active areas given a template ID AJAX callback. More...
 
 get_available_fields_html ()
 AJAX action to get HTML markup for form(s) or template fields AJAX callback. More...
 
 get_field_options ()
 Returns field options - called by ajax when dropping fields into active areas AJAX callback. More...
 
 get_preset_fields_config ()
 Fill in active areas with preset configuration according to the template selected. More...
 
 get_sortable_fields ()
 Given a View id, calculates the assigned form, and returns the form fields (only the sortable ones ) AJAX callback. More...
 
 import_fields ( $file)
 Import fields configuration from an exported WordPress View preset. More...
 
 import_form ( $xml_or_json_path='')
 Import Gravity Form XML or JSON. More...
 

Static Public Member Functions

static pre_get_form_fields ( $template_id='')
 Get the form fields for a preset (no form created yet) More...
 

Private Member Functions

 _exit ( $mixed=NULL)
 Handle exiting the script (for unit testing) More...
 

Detailed Description

Definition at line 3 of file class-ajax.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( )

Definition at line 5 of file class-ajax.php.

Member Function Documentation

◆ _exit()

_exit (   $mixed = NULL)
private

Handle exiting the script (for unit testing)

Since
1.15
Parameters
bool | false$mixed
Returns
bool

Don't exit if we're running test suite.

Since
1.15

Definition at line 33 of file class-ajax.php.

Referenced by check_ajax_nonce(), create_preset_form(), get_active_areas(), get_available_fields_html(), get_field_options(), get_preset_fields_config(), and get_sortable_fields().

◆ check_ajax_nonce()

check_ajax_nonce ( )

--—— AJAX ----——

Verify the nonce. Exit if not verified.

Returns
void

Definition at line 52 of file class-ajax.php.

References _exit().

Referenced by create_preset_form(), get_active_areas(), get_available_fields_html(), get_field_options(), get_preset_fields_config(), and get_sortable_fields().

◆ create_preset_form()

create_preset_form ( )

Create the preset form requested before the View save.

Returns
void

Definition at line 189 of file class-ajax.php.

References GV\$form, _exit(), check_ajax_nonce(), gravityview(), and import_form().

◆ get_active_areas()

get_active_areas ( )

Returns template active areas given a template ID AJAX callback.

Returns
void

Definition at line 111 of file class-ajax.php.

References _exit(), and check_ajax_nonce().

◆ get_available_fields_html()

get_available_fields_html ( )

AJAX action to get HTML markup for form(s) or template fields AJAX callback.

Returns
array|void Terminate request, exit with JSON response or return HTML markup

Definition at line 64 of file class-ajax.php.

References _exit(), and check_ajax_nonce().

◆ get_field_options()

get_field_options ( )

Returns field options - called by ajax when dropping fields into active areas AJAX callback.

Returns
void

Definition at line 254 of file class-ajax.php.

References $form_id, _exit(), check_ajax_nonce(), gravityview(), gravityview_strip_whitespace(), and GravityView_Render_Settings\render_field_options().

◆ get_preset_fields_config()

get_preset_fields_config ( )

Fill in active areas with preset configuration according to the template selected.

Returns
void

Definition at line 135 of file class-ajax.php.

References _exit(), check_ajax_nonce(), Widget\get_default_widget_areas(), gravityview(), and import_fields().

◆ get_sortable_fields()

get_sortable_fields ( )

Given a View id, calculates the assigned form, and returns the form fields (only the sortable ones ) AJAX callback.

Returns
void

Definition at line 287 of file class-ajax.php.

References GV\$form, _exit(), check_ajax_nonce(), gravityview_get_sortable_fields(), gravityview_strip_whitespace(), and pre_get_form_fields().

◆ import_fields()

import_fields (   $file)

Import fields configuration from an exported WordPress View preset.

Parameters
string$filepath to file
Returns
array Fields config array (unserialized)

Definition at line 355 of file class-ajax.php.

References gravityview(), and GRAVITYVIEW_DIR.

Referenced by get_preset_fields_config().

◆ import_form()

import_form (   $xml_or_json_path = '')

Import Gravity Form XML or JSON.

Parameters
string$xml_or_json_pathPath to form XML or JSON file
Returns
int|bool Imported form ID or false

Definition at line 222 of file class-ajax.php.

References $forms, and gravityview().

Referenced by create_preset_form().

◆ pre_get_form_fields()

static pre_get_form_fields (   $template_id = '')
static

Get the form fields for a preset (no form created yet)

Parameters
string$template_idPreset template
Returns
array|false

Definition at line 319 of file class-ajax.php.

References GV\$form, $forms, and gravityview().

Referenced by GVCommon\get_form_or_form_template(), GravityView_Widget_Search\get_searchable_fields(), get_sortable_fields(), and GravityView_Admin_Views\render_active_areas().


The documentation for this class was generated from the following file: