GV_Extension_DataTables_Data
Source: includes/class-datatables-data.php:36
Details
- Kind:
class - Namespace:
(global)
Properties
| Property | Type | Description |
|---|---|---|
$test_headers | string[] | Response headers captured instead of sent while tests are running. |
Methods
| Method | Description |
|---|---|
get_instance() | Returns the shared instance. |
is_rendering_pdf() | Whether PDF for GravityView is building a PDF. A PDF runs no scripts, so a View's script would print as text. |
set_request_page() | Points the request's page keys at one page while a table's rows render. |
is_hidden_until_searched() | Whether the View withholds its entries because the request has not searched it yet. |
is_preloaded() | Whether the View's table loads all its rows with the page (Preloaded mode) instead of asking the server on each draw. |
has_random_sort() | Whether the effective sort of this render (saved View meta, overlaid with shortcode or block overrides) has a Random direction. |
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. |
is_product_with_inputs() | Whether a column shows a whole product field that stores its price and quantity as inputs. |
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_hidden_sort_field_objects() | The fields of the hidden sort columns, built to render and read their values. |
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. |
fetch_entries_only_in_pdf() | Fetches a DataTables View's entries while rendering only in a PDF. On a page, the table loads them over AJAX. |
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:141
is_rendering_pdf()
public static function is_rendering_pdf()
Whether PDF for GravityView is building a PDF. A PDF runs no scripts, so a View's script would print as text.
Returns
bool
Since: 3.14.2
Source: includes/class-datatables-data.php:156
set_request_page()
public static function set_request_page( int $view_id, int $page, bool $add_base=false ): callable
Points the request's page keys at one page while a table's rows render.
GravityView reads pagenum and pagenum_{View ID} for the offset and for Sequence numbers.
Only keys already in the request change, plus pagenum when $add_base is true. The key
names are literal because older GravityView versions have no PaginationKeys class.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$view_id | int | The View ID. | |
$page | int | The page the rows belong to. | |
$add_base | bool | false | Whether to set pagenum when the request has none. |
Returns
callable— Puts every changed key back as it was.
Since: 3.15.0
Source: includes/class-datatables-data.php:175
is_hidden_until_searched()
public static function is_hidden_until_searched( $view, $request=null ): bool
Whether the View withholds its entries because the request has not searched it yet.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$view | View | The View. | |
$request | \GV\Request | null | null | The request. Default: the current request. |
Returns
bool— True when "Hide View data until search is performed" is on and the request does not search the View.
Since: 3.14.0
Source: includes/class-datatables-data.php:212
is_preloaded()
public static function is_preloaded( View $view, ?array $columns=null ): bool
Whether the View's table loads all its rows with the page (Preloaded mode) instead of asking the server on each draw.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$view | View | The View. | |
$columns | array | null | null | The columns built for this render. Default: built from the View. |
Returns
bool— True when the saved processing mode is not the default, or the effective sort is Random.
Since: 3.15.0
Source: includes/class-datatables-data.php:232
has_random_sort()
public static function has_random_sort( View $view, ?array $columns=null ): bool
Whether the effective sort of this render (saved View meta, overlaid with shortcode or block overrides) has a Random direction.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$view | View | The View. | |
$columns | array | null | null | The columns built for this render. Default: built from the View. |
Returns
bool
Since: 3.15.0
Source: includes/class-datatables-data.php:253
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:440
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:474
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:485
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:496
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:509
add_hooks()
function add_hooks()
Since: 1.3
Source: includes/class-datatables-data.php:517
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
| Name | Type | Default | Description |
|---|---|---|---|
$header | string | Full header line, e.g. Content-Length: 128. |
Returns
void
Since: 3.12.0
Source: includes/class-datatables-data.php:578