Skip to main content

GV_Extension_DataTables_Data

Source: includes/class-datatables-data.php:23

Details

  • Kind: class
  • Namespace: (global)

Methods

MethodDescription
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

NameTypeDefaultDescription
$content_typestring'text/plain'Type of content to be set in header.
$cachebooleanfalseDo 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

function add_global_search( $search_criteria )

Add the generic search to the global get_entries query

Parameters

NameTypeDefaultDescription
$search_criteriaarraySearch 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

NameTypeDefaultDescription
$entriesEntry_CollectionThe collection of entries for the current search.
$viewViewThe View.
$postWP_PostnullCurrent 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

NameTypeDefaultDescription
$classstringThe class to use as the template class.
$viewViewThe 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

NameTypeDefaultDescription
$classstringThe class to use as the template class.
$entry\GV\EntryThe Entry we're looking at.
$viewViewThe 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

NameTypeDefaultDescription
$file_pathsarrayList 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

NameTypeDefaultDescription
$viewViewThe 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

NameTypeDefaultDescription
$postWP_PostCurrent View or post/page where View is embedded
$viewViewThe View

Returns

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

NameTypeDefaultDescription
$gravityviewTemplate_ContextThe $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

NameTypeDefaultDescription
$settingsarray
$item_idarray[]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