GravityView  2.17
The best, easiest way to display Gravity Forms entries on your website.
Namespaces | Functions
connector-functions.php File Reference

Go to the source code of this file.

Namespaces

 GravityView
 GPL2+
 

Functions

 get_gravityview ( $view_id='', $atts=array())
 Theme function to get a GravityView view. More...
 
 gravityview_get_connected_views ( $form_id, $args=array())
 Get the views for a particular form. More...
 
 gravityview_get_directory_fields ( $post_id, $apply_filter=true, $form_id=0)
 Get the field configuration for the View. More...
 
 gravityview_get_directory_widgets ( $post_id)
 Get the widgets, as configured for a View. More...
 
 gravityview_get_entries ( $form_ids=null, $passed_criteria=null, &$total=null)
 Retrieve entries given search, sort, paging criteria. More...
 
 gravityview_get_entry ( $entry_slug, $force_allow_ids=false, $check_entry_display=true, $view=null)
 Return a single entry object. More...
 
 gravityview_get_entry_ids ( $form_id, $search_criteria=array())
 Wrapper for the Gravity Forms GFFormsModel::search_lead_ids() method. More...
 
 gravityview_get_entry_meta ( $form_id, $only_default_column=true)
 get extra fields from entry meta More...
 
 gravityview_get_field ( $form, $field_id)
 Returns the field details array of a specific form given the field id. More...
 
 gravityview_get_field_label ( $form, $field_id, $field_value='')
 Retrieve the label of a given field id (for a specific form) More...
 
 gravityview_get_field_type ( $form=null, $field_id='')
 Returns the GF Form field type for a certain field(id) of a form. More...
 
 gravityview_get_form ( $form_id)
 Returns the form object for a given Form ID. More...
 
 gravityview_get_form_fields ( $form='', $add_default_properties=false, $include_parent_field=true)
 Return array of fields' id and label, for a given Form ID. More...
 
 gravityview_get_form_from_entry_id ( $entry_slug)
 Get the form array for an entry based only on the entry ID. More...
 
 gravityview_get_form_id ( $view_id)
 Get the connected form ID from a View ID. More...
 
 gravityview_get_forms ( $active=true, $trash=false, $order_by='date_created', $order='ASC')
 Alias of GFAPI::get_forms() More...
 
 gravityview_get_joined_forms ( $view_id)
 Get joined forms associated with a view. More...
 
 gravityview_get_registered_templates ()
 Get all available preset templates. More...
 
 gravityview_get_sortable_fields ( $formid, $current='')
 Render dropdown (select) with the list of sortable fields from a form ID. More...
 
 gravityview_get_template_id ( $post_id)
 Get the template ID (list, table, datatables, map) for a View. More...
 
 gravityview_get_template_setting ( $post_id, $key)
 Get the setting for a View. More...
 
 gravityview_get_template_settings ( $post_id)
 Get all the settings for a View. More...
 
 gravityview_has_shortcode_r ( $content, $tag='gravityview')
 Placeholder until the recursive has_shortcode() patch is merged. More...
 
 gravityview_is_single_entry ()
 Theme function to identify if it is a Single Entry View. More...
 
 gravityview_set_directory_widgets ( $post_id, $widgets=array())
 Set the widgets, as configured for a View. More...
 
 has_gravityview_shortcode ( $post=NULL)
 Check whether the post is GravityView. More...
 
 the_gravityview ( $view_id='', $atts=array())
 Theme function to render a GravityView view. More...
 

Function Documentation

◆ get_gravityview()

get_gravityview (   $view_id = '',
  $atts = array() 
)

Theme function to get a GravityView view.

Parameters
string$view_id(default: '')
array$atts(default: array())
Returns
string HTML of the output. Empty string if $view_id is empty.

Definition at line 339 of file connector-functions.php.

References $args, $view_id, GravityView_frontend\getInstance(), and GravityView_View_Data\getInstance().

Referenced by the_gravityview().

◆ gravityview_get_connected_views()

gravityview_get_connected_views (   $form_id,
  $args = array() 
)

Get the views for a particular form.

Since
1.22.1 Added $args param
Parameters
int$form_idGravity Forms form ID
array$argsPass args sent to get_posts()
Returns
array Array with view details

Definition at line 184 of file connector-functions.php.

References $args, $form_id, and GVCommon\get_connected_views().

Referenced by GravityView_Admin_Views\gform_toolbar_menu(), and GravityView_Admin_ApproveEntries\show_approve_entry_column().

◆ gravityview_get_directory_fields()

gravityview_get_directory_fields (   $post_id,
  $apply_filter = true,
  $form_id = 0 
)

Get the field configuration for the View.

See also
GVCommon::get_directory_fields
Since
1.17.4 Added $apply_filter parameter.
2.17 Added $form_id parameter.
Parameters
int$post_idView ID.
bool$apply_filterWhether to apply the gravityview/configuration/fields filter [Default: true]
Returns
array Multi-array of fields with first level being the field zones.

Definition at line 278 of file connector-functions.php.

References $form_id, and GVCommon\get_directory_fields().

Referenced by GravityView_Migrate\get_search_fields(), GravityView_Welcome\getting_started_screen(), GravityView_Admin_Views\render_directory_active_areas(), and GravityView_Admin_Metaboxes\render_shortcode_hint().

◆ gravityview_get_directory_widgets()

gravityview_get_directory_widgets (   $post_id)

Get the widgets, as configured for a View.

Since
1.17.4
Parameters
int$post_id
Returns
array

Definition at line 291 of file connector-functions.php.

Referenced by GravityView_Admin_Metaboxes\render_shortcode_hint(), GravityView_Admin_Views\render_widgets_active_areas(), and GravityView_Migrate\update_search_on_views().

◆ gravityview_get_entries()

gravityview_get_entries (   $form_ids = null,
  $passed_criteria = null,
$total = null 
)

Retrieve entries given search, sort, paging criteria.

See also
GFAPI::get_entries()
GFFormsModel::get_field_filters_where()
Parameters
int | array$form_idsThe ID of the form or an array IDs of the Forms. Zero for all forms.
mixed$passed_criteria(default: null)
mixed&$total(default: null)
Returns
mixed False: Error fetching entries. Array: Multi-dimensional array of Gravity Forms entry arrays

Definition at line 100 of file connector-functions.php.

References GVCommon\get_entries().

◆ gravityview_get_entry()

gravityview_get_entry (   $entry_slug,
  $force_allow_ids = false,
  $check_entry_display = true,
  $view = null 
)

Return a single entry object.

Since 1.4, supports custom entry slugs. The way that GravityView fetches an entry based on the custom slug is by searching gravityview_unique_id meta. The $entry_slug is fetched by getting the current query var set by is_single_entry()

Since
1.4 Supports custom entry slugs
2.6 Added $view parameter
Parameters
int | string$entry_slugEntry ID or slug
boolean$force_allow_idsForce the get_entry() method to allow passed entry IDs, even if the gravityview_custom_entry_slug_allow_id filter returns false.
boolean$check_entry_displayCheck whether the entry is visible for the current View configuration. Default: true {
Since
1.14}
Parameters
\GV\View$viewThe View if $check_entry_display is set to true. {
Since
develop}
Returns
array|boolean

Definition at line 119 of file connector-functions.php.

References $entry_slug, and GVCommon\get_entry().

Referenced by GravityView_Edit_Entry_Render\get_entry(), GravityView_Field_Notes\process_add_note(), GravityView_Delete_Entry\process_delete(), and GravityView_Duplicate_Entry\process_duplicate().

◆ gravityview_get_entry_ids()

gravityview_get_entry_ids (   $form_id,
  $search_criteria = array() 
)

Wrapper for the Gravity Forms GFFormsModel::search_lead_ids() method.

See also
GFEntryList::leads_page()
Parameters
int$form_idID of the Gravity Forms form
Since
1.1.6
Returns
array Array of entry IDs

Definition at line 85 of file connector-functions.php.

References $form_id, and GVCommon\get_entry_ids().

Referenced by GravityView_Admin_ApproveEntries\filter_links_entry_list(), and GravityView_Bulk_Actions\process_bulk_action().

◆ gravityview_get_entry_meta()

gravityview_get_entry_meta (   $form_id,
  $only_default_column = true 
)

get extra fields from entry meta

Parameters
string$form_id(default: '')
Returns
array

Definition at line 73 of file connector-functions.php.

References $form_id, and GVCommon\get_entry_meta().

Referenced by GravityView_Admin_Views\get_available_fields().

◆ gravityview_get_field()

gravityview_get_field (   $form,
  $field_id 
)

Returns the field details array of a specific form given the field id.

Alias of GFFormsModel::get_field

Since
1.19 Allow passing form ID as well as form array

GVCommon::get_field

See also
GFFormsModel::get_field
Parameters
array | int$formForm array or ID
string | int$field_id
Returns
GF_Field|null Returns NULL if field with ID $field_id doesn't exist.

Definition at line 148 of file connector-functions.php.

References $field_id, GV\$form, and GVCommon\get_field().

Referenced by GravityView_Entry_Approval\get_approved_column_input_label(), GravityView_Migrate\get_search_fields(), GravityView_Widget_Search\get_search_filter_details(), GravityView_Admin_View_Item\getOutput(), GravityView_Field\is_choice_value_enabled(), GravityView_Widget_Search\maybe_sieve_filter_choices(), and GravityView_Widget_Search\sieve_filter_choices().

◆ gravityview_get_field_label()

gravityview_get_field_label (   $form,
  $field_id,
  $field_value = '' 
)

Retrieve the label of a given field id (for a specific form)

Parameters
mixed$form
mixed$field_id
Returns
string

Definition at line 130 of file connector-functions.php.

References $field_id, $field_value, GV\$form, and GVCommon\get_field_label().

◆ gravityview_get_field_type()

gravityview_get_field_type (   $form = null,
  $field_id = '' 
)

Returns the GF Form field type for a certain field(id) of a form.

Parameters
object$formGravity Forms form
mixed$field_idField ID or Field array
Returns
string field type

Definition at line 327 of file connector-functions.php.

References $field_id, GV\$form, and GVCommon\get_field_type().

◆ gravityview_get_form()

gravityview_get_form (   $form_id)

◆ gravityview_get_form_fields()

gravityview_get_form_fields (   $form = '',
  $add_default_properties = false,
  $include_parent_field = true 
)

Return array of fields' id and label, for a given Form ID.

See also
GVCommon::get_form_fields()
Parameters
string | array$form_id(default: '') or $form object
Returns
array

Definition at line 64 of file connector-functions.php.

References GV\$form, and GVCommon\get_form_fields().

Referenced by GravityView_Admin_Views\get_available_fields(), and GravityView_Widget_Search\render_searchable_fields().

◆ gravityview_get_form_from_entry_id()

gravityview_get_form_from_entry_id (   $entry_slug)

Get the form array for an entry based only on the entry ID.

See also
GVCommon::get_form_from_entry_id
Parameters
int | string$entry_slugEntry slug
Returns
array Gravity Forms form array

Definition at line 33 of file connector-functions.php.

References $entry_slug, and GVCommon\get_form_from_entry_id().

◆ gravityview_get_form_id()

gravityview_get_form_id (   $view_id)

◆ gravityview_get_forms()

gravityview_get_forms (   $active = true,
  $trash = false,
  $order_by = 'date_created',
  $order = 'ASC' 
)

Alias of GFAPI::get_forms()

See also
GFAPI::get_forms()
Since
1.19 Allow "any" $active status option
2.7.2 Allow sorting forms using wp_list_sort()
Parameters
bool | string$activeStatus of forms. Use any to get array of forms with any status. Default: true
bool$trashInclude forms in trash? Default: false
string | array$order_byOptional. Either the field name to order by or an array of multiple orderby fields as $orderby => $order.
string$orderOptional. Either 'ASC' or 'DESC'. Only used if $orderby is a string.
Returns
array Empty array if GFAPI class isn't available or no forms. Otherwise, the array of Forms

Definition at line 53 of file connector-functions.php.

References GVCommon\get_forms().

Referenced by GravityView_Admin_Views\add_view_dropdown(), and GravityView_HTML_Elements\form_dropdown().

◆ gravityview_get_joined_forms()

gravityview_get_joined_forms (   $view_id)

Get joined forms associated with a view.

Since
2.0.11
Parameters
int$view_idID of the View
Returns
[] Array of instances

Definition at line 210 of file connector-functions.php.

References $view_id.

Referenced by GravityView_Admin_Views\render_active_areas().

◆ gravityview_get_registered_templates()

gravityview_get_registered_templates ( )

Get all available preset templates.

Since
1.13.2
Returns
array Templates
Runs Filter:
gravityview_register_directory_template Fetch available View templates
Parameters
array$templatesTemplates to show

Definition at line 256 of file connector-functions.php.

References $templates.

Referenced by GravityView_Admin_Views\add_custom_column_content(), and GravityView_Admin_Views\add_view_dropdown().

◆ gravityview_get_sortable_fields()

gravityview_get_sortable_fields (   $formid,
  $current = '' 
)

Render dropdown (select) with the list of sortable fields from a form ID.

Parameters
int$formidForm ID
string$currentField ID of field used to sort
Returns
string html

Definition at line 316 of file connector-functions.php.

References GVCommon\get_sortable_fields().

Referenced by GravityView_Admin_Add_Shortcode\get_sortable_fields(), and GravityView_Ajax\get_sortable_fields().

◆ gravityview_get_template_id()

gravityview_get_template_id (   $post_id)

Get the template ID (list, table, datatables, map) for a View.

See also
GravityView_Template::template_id
Parameters
int$view_idThe ID of the View to get the layout of
Returns
string GravityView_Template::template_id value. Empty string if not.

Definition at line 223 of file connector-functions.php.

References GVCommon\get_meta_template_id().

Referenced by GravityView_Admin_Views\add_custom_column_content(), GravityView_frontend\add_scripts_and_styles(), View\from_post(), and GravityView_Admin_Metaboxes\render_view_configuration_metabox().

◆ gravityview_get_template_setting()

gravityview_get_template_setting (   $post_id,
  $key 
)

Get the setting for a View.

If the setting isn't set by the View, it returns the plugin default.

Parameters
int$post_idView ID
string$keyKey for the setting
Returns
mixed|null Setting value, or NULL if not set.

Definition at line 247 of file connector-functions.php.

References GVCommon\get_template_setting().

Referenced by GravityView_Admin_Add_Shortcode\get_sortable_fields().

◆ gravityview_get_template_settings()

gravityview_get_template_settings (   $post_id)

Get all the settings for a View.

::defaults() Parses the settings with the plugin defaults as backups.

Parameters
int$post_idView ID
Returns
array Associative array of settings with plugin defaults used if not set by the View

Definition at line 234 of file connector-functions.php.

References GVCommon\get_template_settings().

Referenced by View\from_post(), and GravityView_Admin_Metaboxes\render_view_settings_metabox().

◆ gravityview_has_shortcode_r()

gravityview_has_shortcode_r (   $content,
  $tag = 'gravityview' 
)

Placeholder until the recursive has_shortcode() patch is merged.

See also
https://core.trac.wordpress.org/ticket/26343#comment:10

Definition at line 170 of file connector-functions.php.

References $content, and GVCommon\has_shortcode_r().

Referenced by GravityView_frontend\parse_content().

◆ gravityview_is_single_entry()

gravityview_is_single_entry ( )

Theme function to identify if it is a Single Entry View.

Since
1.5.4
Returns
bool|string False if not, single entry slug if true

Definition at line 370 of file connector-functions.php.

References $field, $field_id, GV\$form, and GravityView_frontend\is_single_entry().

◆ gravityview_set_directory_widgets()

gravityview_set_directory_widgets (   $post_id,
  $widgets = array() 
)

Set the widgets, as configured for a View.

Since
1.17.4
Parameters
int$post_id
array$widgetsarray of widgets
Returns
int|bool

Definition at line 305 of file connector-functions.php.

Referenced by GravityView_Admin_Views\save_postdata(), and GravityView_Migrate\update_search_on_views().

◆ has_gravityview_shortcode()

has_gravityview_shortcode (   $post = NULL)

Check whether the post is GravityView.

  • Check post type. Is it gravityview?
  • Check shortcode
Parameters
WP_Post$postWordPress post object
Returns
boolean True: yep, GravityView; No: not!

Definition at line 162 of file connector-functions.php.

References $post, and GVCommon\has_gravityview_shortcode().

◆ the_gravityview()

the_gravityview (   $view_id = '',
  $atts = array() 
)

Theme function to render a GravityView view.

Parameters
string$view_id(default: '')
array$atts(default: array())
Returns
void

Definition at line 359 of file connector-functions.php.

References $view_id, and get_gravityview().