GravityView  1.19.4
The best, easiest way to display Gravity Forms entries on your website.
Static Public Member Functions | Static Private Member Functions
GravityView_API Class Reference

Static Public Member Functions

static directory_link ($post_id=NULL, $add_query_args=true)
 Generate a URL to the Directory context. More...
 
static entry_create_custom_slug ($entry, $form)
 If using the entry custom slug feature, make sure the new entries have the custom slug created and saved as meta. More...
 
static entry_link ($entry, $post_id=NULL, $add_directory_args=true)
 return href for single entry More...
 
static entry_link_html ($entry=array(), $anchor_text= '', $passed_tag_atts=array(), $field_settings=array())
 Generate an anchor tag that links to an entry. More...
 
static field_class ($field, $form=NULL, $entry=NULL)
 Fetch Field class. More...
 
static field_html_attr_id ($field, $form=array(), $entry=array())
 Fetch Field HTML ID. More...
 
static field_label ($field, $entry=array(), $force_show_label=false)
 Fetch Field Label. More...
 
static field_value ($entry, $field_settings, $format= 'html')
 Given an entry and a form field id, calculate the entry value for that field. More...
 
static field_width ($field, $format= '%d%%')
 Get column width from the field setting. More...
 
static get_entry_slug ($id_or_string, $entry=array())
 Get the entry slug for the entry. More...
 
static no_results ($wpautop=true)
 Get the "No Results" text depending on whether there were results. More...
 
static replace_variables ($text, $form=array(), $entry=array())
 Alias for GravityView_Merge_Tags::replace_variables() More...
 

Static Private Member Functions

static get_custom_entry_slug ($id, $entry=array())
 Calculate an unique hash for an entry based on the entry ID. More...
 

Detailed Description

Definition at line 14 of file class-api.php.

Member Function Documentation

static directory_link (   $post_id = NULL,
  $add_query_args = true 
)
static

Generate a URL to the Directory context.

Uses wp_cache_get and wp_cache_get (since 1.3) to speed up repeated requests to get permalink, which improves load time. Since we may be doing this hundreds of times per request, it adds up!

Parameters
int$post_idPost ID
boolean$add_query_argsAdd pagination and sorting arguments
Returns
string Permalink to multiple entries view
Runs Filter:
gravityview_directory_link Modify the URL to the View "directory" context
Since
1.19.4
Parameters
string$linkURL to the View's "directory" context (Multiple Entries screen)
int$post_idID of the post to link to. If the View is embedded, it is the post or page ID

Definition at line 428 of file class-api.php.

References $gravityview_view, $post, GravityView_frontend\getInstance(), and GravityView_View\getInstance().

Referenced by GravityView_Delete_Entry\get_delete_link(), and gv_directory_link().

static entry_create_custom_slug (   $entry,
  $form 
)
static

If using the entry custom slug feature, make sure the new entries have the custom slug created and saved as meta.

Triggered by add_action( 'gform_entry_created', array( 'GravityView_API', 'entry_create_custom_slug' ), 10, 2 );

Parameters
$entryarray Gravity Forms entry object
$formarray Gravity Forms form object
Runs Filter:
gravityview_custom_entry_slug On entry creation, check if we are using the custom entry slug feature and update the meta
Parameters
boolean$customShould we process the custom entry slug?

Definition at line 613 of file class-api.php.

References $entry.

static entry_link (   $entry,
  $post_id = NULL,
  $add_directory_args = true 
)
static

return href for single entry

Parameters
array | int$entryEntry array or entry ID
int | null$post_idIf wanting to define the parent post, pass a post ID
boolean$add_directory_argsTrue: Add args to help return to directory; False: only include args required to get to entry {
Since
1.7.3}
Returns
string Link to the entry with the directory parent slug

Deprecated. Use ::get_endpoint_name instead.

Make sure the $directory_link doesn't contain any query otherwise it will break when adding the entry slug.

Since
1.16.5
1.7.3
1.7

Check if we have multiple views embedded in the same page and in that case make sure the single entry link has the view id so that Advanced Filters can be applied correctly when rendering the single view

See also
GravityView_frontend::get_context_view_id()

Definition at line 642 of file class-api.php.

References $entry, $entry_slug, Entry\get_endpoint_name(), GVCommon\get_entry(), GravityView_Post_Types\get_entry_var_name(), GravityView_frontend\getInstance(), GravityView_View_Data\getInstance(), and gravityview_get_view_id().

Referenced by GravityView_Field_FileUpload\field_options(), GravityView_Entry_List\get_item_output(), GravityView_Entry_Link_Shortcode\get_url(), gv_entry_link(), and GravityView_Theme_Hooks_WPML\wpml_ls_filter().

static entry_link_html (   $entry = array(),
  $anchor_text = '',
  $passed_tag_atts = array(),
  $field_settings = array() 
)
static

Generate an anchor tag that links to an entry.

Since
1.6
See also
GVCommon::get_link_html()
Parameters
string$anchor_textThe text or HTML inside the link
array$entryGravity Forms entry array
array | string$passed_tag_attsAttributes to be added to the anchor tag, such as title or rel.
array$field_settingsArray of field settings. Optional, but passed to the gravityview_field_entry_link filter
Returns
string|null Returns HTML for an anchor link. Null if $entry isn't defined or is missing an ID.
Runs Filter:
gravityview_field_entry_link Modify the link HTML
Parameters
string$linkHTML output of the link
string$hrefURL of the link
array$entryThe GF entry array
array$field_settingsSettings for the particular GV field

Definition at line 362 of file class-api.php.

References $entry, $field_settings, $href, $output, and gravityview_get_link().

static field_class (   $field,
  $form = NULL,
  $entry = NULL 
)
static

Fetch Field class.

public

Parameters
mixed$field
Returns
string

Definition at line 142 of file class-api.php.

References $entry, $field, $form, $form_id, $gravityview_view, and GravityView_View\getInstance().

Referenced by gv_class().

static field_html_attr_id (   $field,
  $form = array(),
  $entry = array() 
)
static

Fetch Field HTML ID.

Since
1.11

public

Parameters
array$fieldGravityView field array passed to gravityview_field_output()
array$formGravity Forms form array, if set.
array$entryGravity Forms entry array
Returns
string Sanitized unique HTML id attribute for the field

Definition at line 194 of file class-api.php.

References $field, $form, $form_id, $gravityview_view, and GravityView_View\getInstance().

Referenced by gravityview_field_output().

static field_label (   $field,
  $entry = array(),
  $force_show_label = false 
)
static

Fetch Field Label.

public

Parameters
array$fieldGravityView field array
array$entryGravity Forms entry array
boolean$force_show_labelWhether to always show the label, regardless of field settings
Returns
string
Runs Filter:
gravityview_render_after_label Append content to a field label
Parameters
[in,out]string$appended_contentContent you can add after a label. Empty by default.
[in]array$fieldGravityView field array
Runs Filter:
gravityview/template/field_label Modify field label output
Since
1.7
Parameters
[in,out]string$labelField label HTML
[in]array$fieldGravityView field array
[in]array$formGravity Forms form array
[in]array$entryGravity Forms entry array

Definition at line 26 of file class-api.php.

References $entry, $field, $form, $gravityview_view, $label, and GravityView_View\getInstance().

Referenced by gv_label().

static field_value (   $entry,
  $field_settings,
  $format = 'html' 
)
static

Given an entry and a form field id, calculate the entry value for that field.

public

Parameters
array$entry
array$field
Returns
null|string

{

Since
1.6}

{

Since
1.16}
Runs Filter:
gravityview_field_entry_value_{$field_type}_pre_link Modify the field value output for a field type before Show As Link setting is applied. Example: gravityview_field_entry_value_number_pre_link
Since
1.16
Parameters
string$outputHTML value output
array$entryThe GF entry array
array$field_settingsSettings for the particular GV field
array$fieldField array, as fetched from GravityView_View::getCurrentField()

Link to the single entry by wrapping the output in an anchor tag

Fields can override this by modifying the field data variable inside the field. See /templates/fields/post_image.php for an example.

Runs Filter:
gravityview_field_entry_value_{$field_type} Modify the field value output for a field type. Example: gravityview_field_entry_value_number
Since
1.6
Parameters
string$outputHTML value output
array$entryThe GF entry array
array$field_settingsSettings for the particular GV field
array$fieldCurrent field being displayed
Runs Filter:
gravityview_field_entry_value Modify the field value output for all field types
Parameters
string$outputHTML value output
array$entryThe GF entry array
array$field_settingsSettings for the particular GV field
array$field_data{
Since
1.6}

Definition at line 220 of file class-api.php.

References $entry, $field, $field_id, $field_settings, $form, $format, $gravityview_view, $link_atts, $output, $value, GravityView_Fields\get_associated_field(), GravityView_View\getInstance(), gravityview_get_field(), and gv_empty().

Referenced by gv_value().

static field_width (   $field,
  $format = '%d%%' 
)
static

Get column width from the field setting.

Since
1.9
Parameters
array$fieldArray of settings for the field
string$formatFormat for width. "%" (default) will return
Returns
string|null If not empty, string in $format format. Otherwise, null.

Definition at line 116 of file class-api.php.

References $field, and $format.

Referenced by gravityview_field_output().

static get_custom_entry_slug (   $id,
  $entry = array() 
)
staticprivate

Calculate an unique hash for an entry based on the entry ID.

This allows you to be more discrete as to the number of the entry - if you don't want users to know that you have made a certain number of sales, for example, or that their entry in the giveaway is entry #3.

The hashed value MUST be unique, otherwise multiple entries will share the same URL, which leads to obvious problems.

Parameters
int | string$idEntry ID to generate the hash for.
array$entryEntry data passed to provide additional information when generating the hash. Optional - don't rely on it being available.
Returns
string Hashed unique value for entry
Runs Filter:
gravityview_entry_slug Modify the unique hash ID generated, if you want to improve usability or change the format. This will allow for custom URLs, such as {entryid}-{first-name} or even, if unique, {first-name}-{last-name}
Parameters
string$hashExisting hash generated by GravityView
string$idThe entry ID
array$entryEntry data array. May be empty.

Definition at line 535 of file class-api.php.

References $entry.

static get_entry_slug (   $id_or_string,
  $entry = array() 
)
static

Get the entry slug for the entry.

By default, it is the entry ID.

See also
gravityview_get_entry() GravityView_API::get_custom_entry_slug() If using custom slug, gets the custom slug value
Since
1.4
Parameters
int | string$id_or_stringID of the entry, or custom slug string
array$entryGravity Forms Entry array, optional. Used only to provide data to customize the gravityview_entry_slug filter
Returns
string Unique slug ID, passed through sanitize_title()

Default: use the entry ID as the unique identifier

Runs Filter:
gravityview_custom_entry_slug Whether to enable and use custom entry slugs.
Parameters
booleanTrue: Allow for slugs based on entry values. False: always use entry IDs (default)

Definition at line 567 of file class-api.php.

References $entry, and $value.

Referenced by GravityView_Admin_Bar\add_floaty_icon(), GravityView_Field_FileUpload\field_options(), GravityView_Field_Notes\get_add_note_part(), and GravityView_Delete_Entry\get_delete_link().

static no_results (   $wpautop = true)
static

Get the "No Results" text depending on whether there were results.

Parameters
boolean$wpautopApply wpautop() to the output?
Returns
string HTML of "no results" text
Runs Filter:
gravitview_no_entries_text Modify the text displayed when there are no entries.
Parameters
string$outputThe existing "No Entries" text
boolean$is_searchIs the current page a search result, or just a multiple entries screen?

Definition at line 394 of file class-api.php.

References $gravityview_view, $output, and GravityView_View\getInstance().

Referenced by gv_no_results().

static replace_variables (   $text,
  $form = array(),
  $entry = array() 
)
static

Alias for GravityView_Merge_Tags::replace_variables()

See also
GravityView_Merge_Tags::replace_variables() Moved in 1.8.4
Parameters
string$textText to replace variables in
array$formGF Form array
array$entryGF Entry array
Returns
string Text with variables maybe replaced

Definition at line 102 of file class-api.php.

References $entry, $form, and GravityView_Merge_Tags\replace_variables().

Referenced by GravityView_Entry_List\get_item_output(), GravityView_View\getBackLinkLabel(), and GravityView_frontend\single_entry_title().


The documentation for this class was generated from the following file: