Skip to main content

GV_Extension_DataTables_Data

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

Details​

  • Kind: class
  • Namespace: (global)

Properties​

PropertyTypeDescription
$test_headersstring[]Response headers captured instead of sent while tests are running.

Methods​

MethodDescription
get_instance()Returns the shared instance.
flush_configuration_cache()Clears the per-request configuration cache.
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()
send_response_header()Sends a response header, or records it when tests are running.
check_ajax_nonce()Verify AJAX request nonce
merge_page_query()Merges the live page query the client sent into the render-time snapshot.
get_datatables_nonce()Answers with a fresh nonce so a page served from a full-page cache past the 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
get_record_counts()The DataTables record counts for an already-resolved entry set.
reserve_datatables_query_args()Excludes DataTables' own request parameters from generated GravityView links.
set_global_search_argument()Adds the DataTables global search box value under the temporary dt_global_search argument.
rewrite_global_search()Rewrites the temporary dt_global_search marker into a canonical search_all filter.
allow_search_all()Updates the allowed search fields to include search_all, if the search request does not have it.
set_column_search_arguments()Injects the DataTables per-column searches into the Search Request arguments.
allow_column_search_fields()Adds the DataTables searchable columns to the allowed search fields.
restrict_created_by_user_fields()Restricts the created-by search to the user fields matching the column display format.
restrict_created_by_user_meta_fields()Restricts the created-by search to the user meta keys matching the column display format.
split_created_by_search()Splits a composite-format created-by search into an AND group of per-word filters.
group_column_searches()Combines the per-column searches, and the rewritten global search when present, into one AND group,
get_output_data()Get the array of entry data
mark_entry_link()Marks the anchor that the "Link to single entry" field setting wraps a value in.
mark_phone_link()Marks the anchor a Phone field dials from.
get_query_offset()The SQL OFFSET to apply for server-side AJAX paging: DataTables' own $_POST['start']
get_hidden_sort_fields()Returns the sort fields that need a hidden column, resolved to the form that owns them.
get_visible_field_ids()Field IDs rendered as visible table columns.
classify_ajax_sort_column()Classifies a sort field name posted by the client for the AJAX order path.
get_sortable_form_ids()Form IDs a View may sort by: its own form plus any joined forms.
get_normalized_column_widths()Normalized column widths for a View, in visible column order.
normalize_width_values()Clamps a set of column widths into a coherent layout.
resolve_column_form_id()The form that owns a searched column, read from the View's stored configuration.
maybe_enable_fixed_layout()Adds the legacy width-styling hook when a View configures any column width.
add_fixed_layout_class()Adds the legacy class used to style width-configured tables and their header clones.
disable_fixed_layout()Stops applying the width-styling hook once the View that asked for it has rendered.
filter_posted_shortcode_atts()The subset of a request's shortcode_atts that is safe to apply to the View's settings.
get_effective_sort()Effective sort field/direction pairs for this render: the saved View meta, overlaid
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
has_search_request_arguments()Whether the installed GravityView supports Search Request arguments.
add_search_filters()Registers the filters that turn a table's own state into GravityView search filters.
remove_search_filters()Takes down the filters {@see self::add_search_filters()} registered.

Method Reference​

get_instance()​

public static function get_instance()

Returns the shared instance.

Constructing this class registers AJAX and template hooks, so reusing one instance prevents duplicate hook registrations.

Returns​

Since: 3.10.0

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

flush_configuration_cache()​

public static function flush_configuration_cache()

Clears the per-request configuration cache.

Returns​

  • void

Since: 3.10.0

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

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:180

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:191

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:202

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:215

add_hooks()​

function add_hooks()

Since: 1.3

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

send_response_header()​

public static function send_response_header( $header )

Sends a response header, or records it when tests are running.

Tests cannot observe header(), so the header text is collected in \self::$test_headers() instead. Suppression is kept for parity with the rest of the AJAX headers, which fire after WordPress may have emitted output.

Parameters​

NameTypeDefaultDescription
$headerstringFull header line, e.g. Content-Length: 128.

Returns​

  • void

Since: 3.12.0

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

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:280

merge_page_query()​

public function merge_page_query( array $get, $page_query )

Merges the live page query the client sent into the render-time snapshot.

Union, not array_merge(): array_merge() renumbers numeric-string keys, so ?123=abc became $_GET[0] and a {get:123} filter resolved empty. Snapshot values win on conflict, which is the precedence the previous merge provided.

Parameters​

NameTypeDefaultDescription
$getarrayThe current $_GET, taken from the render-time snapshot.
$page_querystringThe live page query, with or without its leading ?.

Returns​

  • array

Since: 3.12.0

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

get_datatables_nonce()​

public function get_datatables_nonce()

Answers with a fresh nonce so a page served from a full-page cache past the nonce

tick can retry instead of leaving its tables permanently stuck.

Exposes nothing: the same nonce is printed into every rendered page carrying a DataTables View, and it proves only that the request came from this origin.

Returns​

  • string | null — JSON body while tests are running, otherwise exits.

Since: 3.12.0

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

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:358

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:379

get_datatables_data()​

function get_datatables_data()

main AJAX logic to retrieve DataTables data

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

get_record_counts()​

public function get_record_counts( $view, $entries, $request=null ): array

The DataTables record counts for an already-resolved entry set.

recordsTotal is the size of the table as configured, so it only differs from recordsFiltered once the visitor has filtered something; resolving it costs a second count query, which is why it is skipped when nothing is filtered.

Parameters​

NameTypeDefaultDescription
$viewViewThe View.
$entriesEntry_CollectionThe resolved entries.
$request\GV\Request | nullnullThe request context. Defaults to the current one.

Returns​

  • array{recordsTotal: — int, recordsFiltered: int} The counts.

Since: TBD

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

reserve_datatables_query_args()​

public function reserve_datatables_query_args( $args )

Excludes DataTables' own request parameters from generated GravityView links.

Parameters​

NameTypeDefaultDescription
$argsarrayThe reserved query argument keys.

Returns​

  • array — The reserved query argument keys, including DataTables' columns and search.

Since: 3.9.1

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

set_global_search_argument()​

public function set_global_search_argument( $search_arguments, $request_arguments )

Adds the DataTables global search box value under the temporary dt_global_search argument.

The marker key lets \self::rewrite_global_search() convert it to the canonical search_all filter once the request has been parsed.

Parameters​

NameTypeDefaultDescription
$search_argumentsarrayThe search arguments.
$request_argumentsarrayThe request arguments.

Returns​

  • array — The updated search arguments.

Since: 3.9.0

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

public function rewrite_global_search( $filters ): array

Rewrites the temporary dt_global_search marker into a canonical search_all filter.

The marker key (see \self::set_global_search_argument()) is renamed to search_all while dt_global_search is kept as the request key, so the operator allowlist resolves like the native global search and \self::group_column_searches() can target the row to fold it into the per-column AND group. Runs whenever the global search box is used, independent of column searches.

Parameters​

NameTypeDefaultDescription
$filtersarrayThe normalized search filters.

Returns​

  • array — The updated filters.

Since: 3.9.0

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

allow_search_all()​

public function allow_search_all( $allowed, $view, $with_full_field )

Updates the allowed search fields to include search_all, if the search request does not have it.

Parameters​

NameTypeDefaultDescription
$allowedarrayThe allowed search fields.
$view\GV\ViewThe View being searched.
$with_full_fieldboolWhether the allowed array contains the full field information.

Returns​

  • array | mixed

Since: 3.9.0

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

set_column_search_arguments()​

public function set_column_search_arguments( $search_arguments, $request_arguments, $view )

Injects the DataTables per-column searches into the Search Request arguments.

A joined form's field can share its bare ID with the primary form's (Bug #5); when \self::get_column_searches() resolved one to a non-primary, joined form, the <field_id>:<form_id> key is the same shape Search_Request::get_filters_data() already parses to attach that form ID to the resulting filter, so the query runs against the right form's field instead of silently falling back to the primary form's field of the same ID.

Parameters​

NameTypeDefaultDescription
$search_argumentsarrayThe search arguments.
$request_argumentsarrayThe request arguments.
$view\GV\ViewThe View being searched.

Returns​

  • array — The updated search arguments.

Since: 3.9.0

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

allow_column_search_fields()​

public function allow_column_search_fields( $allowed, $view, $with_full_field )

Adds the DataTables searchable columns to the allowed search fields.

Parameters​

NameTypeDefaultDescription
$allowedarrayThe allowed search fields.
$view\GV\ViewThe View being searched.
$with_full_fieldboolWhether the allowed array contains the full field information.

Returns​

  • array | mixed — The updated allowed search fields.

Since: 3.9.0

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

restrict_created_by_user_fields()​

public function restrict_created_by_user_fields( $fields )

Restricts the created-by search to the user fields matching the column display format.

Parameters​

NameTypeDefaultDescription
$fieldsarrayThe default user fields.

Returns​

  • array — The user fields to search.

Since: 3.9.0

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

restrict_created_by_user_meta_fields()​

public function restrict_created_by_user_meta_fields( $meta_fields )

Restricts the created-by search to the user meta keys matching the column display format.

Parameters​

NameTypeDefaultDescription
$meta_fieldsarrayThe default user meta keys.

Returns​

  • array — The user meta keys to search.

Since: 3.9.0

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

public function split_created_by_search( $filters ): array

Splits a composite-format created-by search into an AND group of per-word filters.

Composite formats (first_last_name/last_first_name) render across separate user meta keys, so a multi-word value cannot match a single key with LIKE. The created-by filter is replaced in place by an AND group of per-word created-by filters — each word may match either name part.

Parameters​

NameTypeDefaultDescription
$filtersarrayThe normalized search filters.

Returns​

  • array — The updated filters.

Since: 3.9.0

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

group_column_searches()​

public function group_column_searches( $filters, $request=null ): array

Combines the per-column searches, and the rewritten global search when present, into one AND group,

then ANDs that group against the Search Bar's own filters so a DT filter always narrows.

Search_Request::to_filter() wraps whatever this hook returns in the request's own mode (OR by default, whenever the Search Bar submits its default "any" mode), so returning the DT group as a sibling of the Search Bar filters makes it an OR-alternative instead of a conjunct: a Search Bar match and a disjoint DT filter match union together instead of intersecting, and a DT filter composed with a non-matching Search Bar term returns the DT filter's own matches instead of zero. Nesting both sides under one outer AND group -- (Search Bar filters, at the request's own mode) AND (the DT group) -- leaves the top-level list with a single member, so the outer OR has nothing left to union with. The Search Bar's own any/all mode still governs how the Search Bar's OWN fields combine with each other (preserved as the inner mode on that side of the AND).

The global search row is matched by its dt_global_search request key, assigned by \self::rewrite_global_search(). The composite created-by AND subgroup from \self::split_created_by_search() is matched by its dt_created_by key and folded as a column member.

An entry_date filter (gv_start/gv_end) is a special case: Search_Request::create_filter() gives it operator-specific handling ( between/>=/<=/day) that runs only on the top-level filter list, not on filters nested inside a conditions array (SearchFilter::from_array() has no equivalent date branch and its leaf path requires a value key an entry_date filter never carries, so nesting it as-is would throw). When there is nothing to AND it with (no DT column/global-search group), it is kept out of the AND-nesting and re-attached as its own top-level sibling, unchanged, so create_filter()'s special-case still runs. When a DT group DOES exist, \self::leafify_entry_date_filter() converts it into the operator/value leaf shape Search_Request::create_date_filter() itself produces -- a shape SearchFilter::from_array() already understands with no date branch needed -- and folds it into the group so the date range actually narrows a column filter under "any" mode instead of unioning with it.

Parameters​

NameTypeDefaultDescription
$filtersarrayThe normalized search filters.
$requestSearch_Request | nullnullThe current search request; only its mode() is used, and only when present (@since 3.0.0 in core, younger than the plugin's declared 2.57 minimum).

Returns​

  • array — The updated filters.

Since: 3.9.0

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

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:1965

mark_entry_link()​

public static function mark_entry_link( $link, $href='', $context=null )

Marks the anchor that the "Link to single entry" field setting wraps a value in.

An export appends a link's destination after its label, because that address is the whole value of a File Upload or Website column. The entry permalink is navigation rather than data, so the export needs to tell that one anchor apart from the rest.

The Edit Link field fires this same filter, and there the address is the point of the column, so only the wrapper the field setting adds is marked.

Parameters​

NameTypeDefaultDescription
$linkstringThe link HTML.
$hrefstring''The link destination.
$contextmixednullThe template context the link was rendered in.

Returns​

  • string — The link HTML, carrying the marker attribute when it wraps a field value.

Since: 3.13.0

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

public static function mark_phone_link( $output, $context=null )

Marks the anchor a Phone field dials from.

The address is built out of the number already on show. In the International format the two are written differently -- the national form reads, the E.164 form dials -- so comparing the text cannot tell they are one number, and only the field itself knows.

A deliberate trade: the export then carries the number exactly as the column displays it, and the country code the E.164 form adds is not written to the file. A phone column is one number rendered two ways, and a spreadsheet of it should read like the table it came from.

Parameters​

NameTypeDefaultDescription
$outputstringThe rendered field.
$contextmixednullThe template context the field was rendered in.

Returns​

  • string — The rendered field, with its dialing anchor marked.

Since: 3.13.0

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

get_query_offset()​

public static function get_query_offset( $offset, $view_offset )

The SQL OFFSET to apply for server-side AJAX paging: DataTables' own $_POST['start']

plus the View's "Offset entries starting from" setting, a content filter that always applies on top of pagination.

Parameters​

NameTypeDefaultDescription
$offsetintDataTables' $_POST['start'].
$view_offsetintThe View's "Offset entries starting from" setting.

Returns​

  • int

Since: 3.12.0

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

get_hidden_sort_fields()​

public static function get_hidden_sort_fields( $view )

Returns the sort fields that need a hidden column, resolved to the form that owns them.

DataTables refuses to initialize when the header cell count and the column config disagree ("Incorrect column count"), so the template and the config must derive their hidden sort columns from this one list. A joined form's field is stored as <form_id>_<field_id> and does not resolve against the primary form, so a Multiple Forms View sorted by a joined field needs the owning form to place its header cell and its column config in agreement.

Parameters​

NameTypeDefaultDescription
$view\GV\ViewThe View.

Returns​

  • array<int,array{sort_field:string,form_id:int,field_id:string,field:mixed}>

Since: 3.12.0

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

get_visible_field_ids()​

public static function get_visible_field_ids( $view )

Field IDs rendered as visible table columns.

Parameters​

NameTypeDefaultDescription
$view\GV\ViewThe View.

Returns​

  • string[]

Since: 3.12.0

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

classify_ajax_sort_column()​

public static function classify_ajax_sort_column( $view, $sort_field )

Classifies a sort field name posted by the client for the AJAX order path.

A bare name (a field ID, an input ID like 1.3, or an internal field name) is primary and passes through to core untouched. A &lt;form_id&gt;_ prefixed name is joined once the prefix names a form this View actually joins, or unresolvable otherwise: the client does not get to widen the query's form surface.

Parameters​

NameTypeDefaultDescription
$view\GV\ViewThe View.
$sort_fieldstringThe posted sort field, with the gv_ prefix already removed.

Returns​

  • array{status:string,field_id:string,form_id?:int} — status is primary, joined or unresolvable; field_id is empty when unresolvable.

Since: 3.12.0

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

get_sortable_form_ids()​

public static function get_sortable_form_ids( $view )

Form IDs a View may sort by: its own form plus any joined forms.

Bounds the sort surface, since the sort field also arrives from the AJAX request.

Parameters​

NameTypeDefaultDescription
$view\GV\ViewThe View.

Returns​

  • int[]

Since: 3.12.0

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

get_normalized_column_widths()​

public static function get_normalized_column_widths( $view )

Normalized column widths for a View, in visible column order.

The rendered widths come from the &lt;th style&gt; the table template writes, because DataTables ignores columns.width once autoWidth is off (it only applies widths inside _fnCalculateColumnWidths, which is gated on that option). The template and the JS config therefore both read the widths from here, so a clamp or a rescale cannot apply to one and not the other.

Parameters​

NameTypeDefaultDescription
$view\GV\ViewThe View.

Returns​

  • array<int,int | null> — Percentages keyed by visible column index; null means size by content.

Since: 3.12.0

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

normalize_width_values()​

public static function normalize_width_values( array $widths )

Clamps a set of column widths into a coherent layout.

Widths over 100 in total are treated as ratios so the result does not depend on the browser. Columns without a width take an equal share of what is left, so a partial configuration remains a coherent set of percentages. When the set widths claim everything, there is no share to give and every width is dropped so the table sizes by content instead of rendering unusable columns.

Parameters​

NameTypeDefaultDescription
$widthsarray<int,int | null>Percentages keyed by column index; null for unset.

Returns​

  • array<int,int | null>

Since: 3.12.0

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

resolve_column_form_id()​

public static function resolve_column_form_id( $view, $field_id )

The form that owns a searched column, read from the View's stored configuration.

A Multiple Forms View shows columns from more than one form, and resolving them all against the View's own form queries the wrong field: wrong results, or none. Complex fields suffer most, since Name and Address tokenization needs the real field object to recognize them.

The stored configuration is authoritative; the client posts a form_id too, but a query must not be built from it.

Parameters​

NameTypeDefaultDescription
$view\GV\ViewThe View.
$field_idstringThe searched column's field ID.

Returns​

  • int

Since: 3.12.0

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

maybe_enable_fixed_layout()​

public static function maybe_enable_fixed_layout( $gravityview )

Adds the legacy width-styling hook when a View configures any column width.

The class name predates the automatic-layout implementation. It now supplies the border-box and wrapping rules needed by width-configured tables and FixedHeader clones; it does not select CSS fixed layout.

Runs before the template prints the &lt;table&gt; tag, since the footer config is built afterwards and a filter registered there would arrive too late.

Parameters​

NameTypeDefaultDescription
$gravityviewobjectThe template context.

Returns​

  • void

Since: 3.12.0

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

add_fixed_layout_class()​

public static function add_fixed_layout_class( $classes )

Adds the legacy class used to style width-configured tables and their header clones.

Parameters​

NameTypeDefaultDescription
$classesstringExisting table classes.

Returns​

  • string

Since: 3.12.0

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

disable_fixed_layout()​

public static function disable_fixed_layout()

Stops applying the width-styling hook once the View that asked for it has rendered.

Returns​

  • void

Since: 3.12.0

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

filter_posted_shortcode_atts()​

public static function filter_posted_shortcode_atts( $posted, array $trusted=[] )

The subset of a request's shortcode_atts that is safe to apply to the View's settings.

This runs on a nopriv endpoint, so the payload is request data from an unauthenticated caller; the accompanying nonce proves the request's origin, not the caller's authorization or the payload's contents. Applied values may therefore only ever NARROW the result set.

An author's entry pre-filter is part of the View's configuration, so a request cannot be allowed to replace or clear one: when $trusted['search_value'] is present, the request's copy is discarded whole. An empty search_value is as dangerous as a conflicting one, because GravityView omits the implicit filter entirely for an empty value.

With no server-derived filter, the same keys are accepted: they can only add a predicate, and for a View embedded via do_shortcode() or a page builder that stores content outside post_content, the request's copy is the only place the author's filter survives.

Parameters​

NameTypeDefaultDescription
$postedmixedRaw shortcode_atts from the request. Any type; non-arrays yield no atts.
$trustedarray[]Server-derived search_field / search_value / search_operator.

Returns​

  • array<string,string> — Attributes to apply, keyed by setting name. Empty when none qualify.

Since: 3.12.0

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

get_effective_sort()​

public function get_effective_sort( $view, array $columns )

Effective sort field/direction pairs for this render: the saved View meta, overlaid

with validated shortcode/block sort overrides.

Render-time only. get_hidden_sort_fields() and get_output_data() (the AJAX path) must keep computing hidden columns from saved meta alone -- that AJAX endpoint is nopriv and $_POST['shortcode_atts'] is attacker-writable, so letting a posted att create a hidden sort column would give an unauthenticated visitor a read primitive on any non-displayed field. This method is never called from the AJAX handler.

An override's sort_field only takes effect when it names a column already present in $columns (a visible column or one of get_hidden_sort_fields()'s hidden columns); an override naming anything else is dropped in its entirety -- both field and direction fall back to the saved pair -- and logged. sort_direction (or sort_direction_2) posted without a matching sort_field override replaces only that index's direction.

Shared with GV_Extension_DataTables_Processing_Mode::add_config(), so the "does this render want a random sort" check (F-9) sees exactly the same effective sort this method's caller turns into order, including a sort_direction=RAND override that survived core's sanitization.

Parameters​

NameTypeDefaultDescription
$view\GV\ViewThe View being rendered.
$columnsarrayThe columns already built for this render (visible + hidden-sort).

Returns​

  • array{fields:array,directions:array} — Keyed the same way the sort_field / sort_direction settings are.

Since: 3.12.0

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

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:2988

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:3015

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:3033

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:3052

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:3076

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:3338

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:3399

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:3737

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:3905

has_search_request_arguments()​

public static function has_search_request_arguments(): bool

Whether the installed GravityView supports Search Request arguments.

Returns​

  • bool — Always true on a supported (>= 2.57) install.

Since: 3.9.0

Deprecated: 3.12.0 (GravityView 2.57 is this plugin's declared minimum (\GV_Extension_DataTables::$_min_gravityview_version()), so every supported install satisfies this check and it always returns true. The pre-2.57 paths it gated (the legacy Created By column-search regex and the legacy global-search filter) are gone. Kept because the method is public and dates to 3.9.0.)

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

add_search_filters()​

public function add_search_filters(): void

Registers the filters that turn a table's own state into GravityView search filters.

The callbacks read the column and global-search values out of the request arguments, so they serve any transport that carries them: the table's POST body, or the query string of a faceted-search refresh.

While registered they change search semantics for every query in the request — column searches are ANDed, and fields the Search Bar does not declare become searchable — so they belong around one resolved query, not the whole page load. \self::remove_search_filters() takes them down again; a caller that can throw in between is responsible for pairing them.

Returns​

  • void

Since: TBD

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

remove_search_filters()​

public function remove_search_filters(): void

Takes down the filters {@see self::add_search_filters()} registered.

Returns​

  • void

Since: TBD

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