GravityView  1.19.4
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
 includes
 

Functions

 get_gravityview ($view_id= '', $atts=array())
 Theme function to get a GravityView view. More...
 
 gravityview_get_connected_views ($form_id)
 Get the views for a particular form. More...
 
 gravityview_get_directory_fields ($post_id, $apply_filter=true)
 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)
 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)
 Alias of GFAPI::get_forms() 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 (   $view_id = '',
  $atts = array() 
)

Theme function to get a GravityView view.

public

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 344 of file connector-functions.php.

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

Referenced by GravityView_Welcome\getting_started_screen(), and the_gravityview().

gravityview_get_connected_views (   $form_id)

Get the views for a particular form.

Parameters
int$form_idGravity Forms form ID
Returns
array Array with view details

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

References $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 (   $post_id,
  $apply_filter = true 
)

Get the field configuration for the View.

array(

[other zones]

'directory_list-title' => array(

[other fields]

'5372653f25d44' => array(
    'id' => string '9' (length=1)
    'label' => string 'Screenshots' (length=11)
    'show_label' => string '1' (length=1)
    'custom_label' => string '' (length=0)
    'custom_class' => string 'gv-gallery' (length=10)
        'only_loggedin' => string '0' (length=1)
    'only_loggedin_cap' => string 'read' (length=4)
)

    [other fields]

)

[other zones] )

Since
1.17.4 Added $apply_filter 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. See code comment.

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

References GVCommon\get_directory_fields().

Referenced by GravityView_View_Data\get_fields(), GravityView_Migrate\get_search_fields(), GravityView_Admin_Views\render_directory_active_areas(), and GravityView_Admin_Metaboxes\render_shortcode_hint().

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 294 of file connector-functions.php.

Referenced by GravityView_View_Data\add_view(), GravityView_Admin_Views\render_widgets_active_areas(), and GravityView_Migrate\update_search_on_views().

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() public
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 101 of file connector-functions.php.

References GVCommon\get_entries().

Referenced by GravityView_frontend\get_search_criteria().

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

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()

public

Parameters
mixed$entry_id
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}
Returns
array|boolean

Definition at line 116 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(), and GravityView_Delete_Entry\process_delete().

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_Admin_ApproveEntries\process_bulk_action().

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 (   $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 public
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 147 of file connector-functions.php.

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

Referenced by GravityView_API\field_value(), GravityView_Entry_Approval\get_approved_column_input_label(), GravityView_Migrate\get_search_fields(), GravityView_Widget_Search\get_search_filter_details(), GravityView_Field\is_choice_value_enabled(), and GravityView_Widget_Search\prepare_field_filter().

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

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

public

Parameters
mixed$form
mixed$field_id
Returns
string

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

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

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 331 of file connector-functions.php.

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

gravityview_get_form (   $form_id)
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() public
Parameters
string | array$form_id(default: '') or $form object
Returns
array

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

References $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 (   $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 35 of file connector-functions.php.

References $entry_slug, and GVCommon\get_form_from_entry_id().

gravityview_get_form_id (   $view_id)
gravityview_get_forms (   $active = true,
  $trash = false 
)

Alias of GFAPI::get_forms()

See also
GFAPI::get_forms()
Since
1.19 Allow "any" $active status option
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
Returns
array Empty array if GFAPI class isn't available or no forms. Otherwise, the array of Forms

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

References GVCommon\get_forms().

Referenced by GravityView_Admin_Views\add_view_dropdown().

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 237 of file connector-functions.php.

References $templates.

Referenced by GravityView_Admin_Views\add_custom_column_content().

gravityview_get_sortable_fields (   $formid,
  $current = '' 
)

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

public

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

Definition at line 320 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 (   $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 204 of file connector-functions.php.

References GVCommon\get_meta_template_id().

Referenced by GravityView_Admin_Views\add_custom_column_content(), GravityView_View_Data\add_view(), and GravityView_Admin_Metaboxes\render_view_configuration_metabox().

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 228 of file connector-functions.php.

References GVCommon\get_template_setting().

Referenced by GravityView_Admin_Add_Shortcode\get_sortable_fields().

gravityview_get_template_settings (   $post_id)

Get all the settings for a View.

GravityView_View_Data::get_default_args() 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 215 of file connector-functions.php.

References GVCommon\get_template_settings().

Referenced by GravityView_View_Data\add_view(), GravityView_Recent_Entries_Widget\get_entries(), and GravityView_Admin_Metaboxes\render_view_settings_metabox().

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 169 of file connector-functions.php.

References $content, and GVCommon\has_shortcode_r().

Referenced by GravityView_frontend\parse_content(), and GravityView_View_Data\parse_post_content().

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 376 of file connector-functions.php.

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

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 308 of file connector-functions.php.

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

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 161 of file connector-functions.php.

References $post, and GVCommon\has_gravityview_shortcode().

Referenced by GravityView_Widget\add_shortcode().

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

Theme function to render a GravityView view.

public

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

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

References $view_id, and get_gravityview().

Referenced by GravityView_oEmbed\generate_entry_output().