GV_Extension_DataTables_Data
Source: includes/class-datatables-data.php:23
Details
- Kind:
class - Namespace:
(global)
Methods
| Method | Description |
|---|---|
maybe_bootstrap_wp() | If this file is being accessed directly, then set up WP so we can handle the AJAX request |
bootstrap_setup_globals() | Create required globals for minimal bootstrap |
bootstrap_gv() | Include Gravity Forms, GravityView, and GravityView Extensions |
bootstrap_wp_for_direct_access() | Include only the WP files needed |
add_hooks() | |
check_ajax_nonce() | Verify AJAX request nonce |
reduce_query_load() | Removes the queries caused by widgets_init for AJAX calls (and for generating the data) |
do_ajax_headers() | Get AJAX ready by defining AJAX constants and sending proper headers. |
get_datatables_data() | main AJAX logic to retrieve DataTables data |
add_global_search() | Add the generic search to the global get_entries query |
get_output_data() | Get the array of entry data |
get_user_session() | Calculates the user ID and Session Token to be used when calculating the Cache Key |
set_view_template_class() | Override the template class to the correct one. |
set_entry_template_class() | Override the template class to use the correct one. |
add_template_path() | Include this extension templates path |
get_length_menu() | Generate the values for the page length menu |
get_ajax_url() | Get the url to the AJAX endpoint in use |
get_datatables_script_configuration() | Generate the script configuration array |
add_scripts_and_styles() | Enqueue Scripts and Styles for DataTable View Type |
maybe_modify_inline_edit_settings() | Modify Inline Edit settings |
Method Reference
maybe_bootstrap_wp()
function maybe_bootstrap_wp()
If this file is being accessed directly, then set up WP so we can handle the AJAX request
Since: 1.3
Deprecated: Remove direct access altogether.
Source: includes/class-datatables-data.php:57
bootstrap_setup_globals()
function bootstrap_setup_globals()
Create required globals for minimal bootstrap
Since: 1.3
Deprecated: Remove direct access altogether.
Source: includes/class-datatables-data.php:68
bootstrap_gv()
function bootstrap_gv()
Include Gravity Forms, GravityView, and GravityView Extensions
Since: 1.3
Deprecated: Remove direct access altogether.
Source: includes/class-datatables-data.php:79
bootstrap_wp_for_direct_access()
function bootstrap_wp_for_direct_access()
Include only the WP files needed
This brilliant piece of code (cough) is from the dsIDXpress plugin.
Since: 1.3
Deprecated: Remove direct access altogether.
Source: includes/class-datatables-data.php:92
add_hooks()
function add_hooks()
Since: 1.3
Source: includes/class-datatables-data.php:100
check_ajax_nonce()
function check_ajax_nonce()
Verify AJAX request nonce
Returns
boolean— Whether the nonce is okay or not.
Source: includes/class-datatables-data.php:134
reduce_query_load()
public function reduce_query_load()
Removes the queries caused by widgets_init for AJAX calls (and for generating the data)
Returns
void
Since: 2.3.1
Source: includes/class-datatables-data.php:152
do_ajax_headers()
static function do_ajax_headers( $content_type='text/plain', $cache=false )
Get AJAX ready by defining AJAX constants and sending proper headers.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$content_type | string | 'text/plain' | Type of content to be set in header. |
$cache | boolean | false | Do you want to cache the results? |
Since: 1.1
Source: includes/class-datatables-data.php:173
get_datatables_data()
function get_datatables_data()
main AJAX logic to retrieve DataTables data
Source: includes/class-datatables-data.php:238
add_global_search()
function add_global_search( $search_criteria )
Add the generic search to the global get_entries query
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$search_criteria | array | Search Criteria |
Returns
mixed
Since: 1.3.3
Source: includes/class-datatables-data.php:564
get_output_data()
public function get_output_data( $entries, $view, $post=null )
Get the array of entry data
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$entries | Entry_Collection | The collection of entries for the current search. | |
$view | View | The View. | |
$post | WP_Post | null | Current View or post/page where View is embedded. |
Returns
array
Since: 1.3
Source: includes/class-datatables-data.php:622
get_user_session()
function get_user_session()
Calculates the user ID and Session Token to be used when calculating the Cache Key
Returns
string
Source: includes/class-datatables-data.php:771
set_view_template_class()
public function set_view_template_class( $class, $view )
Override the template class to the correct one.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$class | string | The class to use as the template class. | |
$view | View | The View we're looking at. |
Returns
string— The class
Source: includes/class-datatables-data.php:798
set_entry_template_class()
public function set_entry_template_class( $class, $entry, $view )
Override the template class to use the correct one.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$class | string | The class to use as the template class. | |
$entry | \GV\Entry | The Entry we're looking at. | |
$view | View | The View we're looking at. |
Returns
string— The class
Source: includes/class-datatables-data.php:816
add_template_path()
function add_template_path( $file_paths )
Include this extension templates path
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$file_paths | array | List of template paths ordered |
Source: includes/class-datatables-data.php:835
get_length_menu()
function get_length_menu( $view )
Generate the values for the page length menu
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$view | View | The View |
Returns
array— 2D array formatted for DataTables
Source: includes/class-datatables-data.php:859
get_ajax_url()
function get_ajax_url()
Get the url to the AJAX endpoint in use
Returns
string— If direct access, it's this file. otherwise, admin-ajax.php
Source: includes/class-datatables-data.php:1110
get_datatables_script_configuration()
public function get_datatables_script_configuration( $post, $view )
Generate the script configuration array
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$post | WP_Post | Current View or post/page where View is embedded | |
$view | View | The View |
Returns
array— Array of settings formatted as DataTables options array. {@see https://datatables.net/reference/option/}
Since: 1.3.3
Source: includes/class-datatables-data.php:1155
add_scripts_and_styles()
public function add_scripts_and_styles( $gravityview )
Enqueue Scripts and Styles for DataTable View Type
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$gravityview | Template_Context | The $gravityview object available in templates. |
Since: 2.5 (Added $gravityview parameter)
Source: includes/class-datatables-data.php:1368
maybe_modify_inline_edit_settings()
function maybe_modify_inline_edit_settings( $settings, $item_id=[] )
Modify Inline Edit settings
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$settings | array | ||
$item_id | array | [] | Array with form_id or view_id set |
Returns
array— Array with Inline Edit settings
Since: 2.3
Source: includes/class-datatables-data.php:1530