GravityView  1.19.4
The best, easiest way to display Gravity Forms entries on your website.
Data Structures | Namespaces | Functions
class-api.php File Reference

Go to the source code of this file.

Data Structures

class  GravityView_API
 

Namespaces

 GravityView
 includes
 

Functions

 gravityview_after ()
 
 gravityview_back_link ()
 Generate HTML for the back link from single entry view. More...
 
 gravityview_before ()
 
 gravityview_convert_value_to_term_list ($value, $taxonomy= 'post_tag')
 Take a passed CSV of terms and generate a linked list of terms. More...
 
 gravityview_field_output ($passed_args)
 Output field based on a certain html markup. More...
 
 gravityview_footer ()
 
 gravityview_get_context ()
 GravityView_View $gravityview_view More...
 
 gravityview_get_current_view_data ($view_id=0)
 Get data for a specific view. More...
 
 gravityview_get_current_views ()
 Get all views processed so far for the current page load. More...
 
 gravityview_get_field_value ($entry, $field_id, $display_value)
 Handle getting values for complex Gravity Forms fields. More...
 
 gravityview_get_files_array ($value, $gv_class= '')
 Return an array of files prepared for output. More...
 
 gravityview_get_map_link ($address)
 Generate a mapping link from an address. More...
 
 gravityview_get_the_term_list ($post_id, $link=true, $taxonomy= 'post_tag')
 Get the links for post_tags and post_category output based on post ID. More...
 
 gravityview_get_view_id ()
 Get the current View ID being rendered. More...
 
 gravityview_header ()
 
 gv_class ($field, $form=NULL, $entry=array())
 
 gv_container_class ($passed_css_class= '', $echo=true)
 Generate a CSS class to be added to the wrapper

of a View.
More...
 
 gv_directory_link ($post=NULL, $add_pagination=true)
 
 gv_entry_link ($entry, $post_id=NULL)
 
 gv_label ($field, $entry=NULL)
 
 gv_no_results ($wpautop=true)
 
 gv_value ($entry, $field)
 

Function Documentation

gravityview_after ( )
Runs Actions:
gravityview_after Append content to the View container <div>
Parameters
int$view_idThe ID of the View being displayed

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

References gravityview_get_view_id().

gravityview_back_link ( )

Generate HTML for the back link from single entry view.

Since
1.0.1
Returns
string|null If no GV post exists, null. Otherwise, HTML string of back link.
Runs Filter:
gravityview_go_back_url Modify the back link URL
Since
1.17.5
See also
gv_directory_link() Generated the original back link
Parameters
string$hrefExisting label URL
Runs Filter:
gravityview_go_back_label Modify the back link text
Since
1.0.9
Parameters
string$labelExisting label text

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

References $gravityview_view, $href, $label, GravityView_View\getInstance(), gravityview_get_link(), and gv_directory_link().

gravityview_before ( )
Runs Actions:
gravityview_before Display content before a View. Used to render widget areas. Rendered outside the View container <div>
Parameters
int$view_idThe ID of the View being displayed

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

References gravityview_get_view_id().

gravityview_convert_value_to_term_list (   $value,
  $taxonomy = 'post_tag' 
)

Take a passed CSV of terms and generate a linked list of terms.

Gravity Forms passes categories as "Name:ID" so we handle that using the ID, which is more accurate than checking the name, which is more likely to change.

Parameters
string$valueExisting value
string$taxonomyType of term (post_tag or category)
Returns
string CSV of linked terms

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

References $output, $value, and gravityview_get_link().

gravityview_field_output (   $passed_args)

Output field based on a certain html markup.

markup - string to be used on a sprintf statement. Use: {{label}} - field label {{value}} - entry field value {{class}} - field class

wpautop - true will filter the value using wpautop function

Since
1.1.5
Parameters
array$passed_argsAssociative array with field data. field and form are required.
Returns
string Field output. If empty value and hide empty is true, return empty.
Runs Filter:
gravityview/field_output/args Modify the args before generation begins
Since
1.7
Parameters
array$argsAssociative array; field and form is required.
array$passed_argsOriginal associative array with field data. field and form are required.

Create the content variables for replacing.

Since
1.11
Runs Filter:
gravityview/field_output/pre_html Allow Pre filtering of the HTML
Since
1.11
Parameters
string$markupThe HTML for the markup
array$argsAll args for the field output
Runs Filter:
gravityview/field_output/open_tag Modify the opening tags for the template content placeholders
Since
1.11
Parameters
string$open_tagOpen tag for template content placeholders. Default: {{
Runs Filter:
gravityview/field_output/close_tag Modify the closing tags for the template content placeholders
Since
1.11
Parameters
string$close_tagClose tag for template content placeholders. Default: }}

Loop through each of the tags to replace and replace both {{tag}} and {{ tag }} with the values

Since
1.11

gravityview/field_output/context/{$tag} Allow users to filter content on context

Since
1.11
Parameters
string$valueThe content to be shown instead of the {{tag}} placeholder
array$argsArguments passed to the function
Runs Filter:
gravityview/field_output/html Modify field HTML output
Parameters
string$htmlExisting HTML output
array$argsArguments passed to the function

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

References $entry, $html, $value, GravityView_API\field_html_attr_id(), GravityView_API\field_width(), gv_class(), gv_label(), and gv_value().

Referenced by GravityView_View\renderZone().

gravityview_footer ( )
Runs Actions:
gravityview_after Display content after a View. Used to render footer widget areas. Rendered outside the View container <div>
Parameters
int$view_idThe ID of the View being displayed

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

References gravityview_get_view_id().

gravityview_get_context ( )

GravityView_View $gravityview_view

Returns
string View context "directory", "single", or "edit"
Runs Filter:
gravityview_is_edit_entry Whether we're currently on the Edit Entry screen
The Edit Entry functionality overrides this value.
Parameters
boolean$is_edit_entry

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

References GravityView_View\getInstance(), and GravityView_frontend\is_single_entry().

Referenced by GravityView_Plugin_Hooks_Gravity_Forms_Signature\edit_entry_field_input(), GravityView_Field_FileUpload\field_options(), GVCommon\matches_operation(), GravityView_frontend\render_view(), and GravityView_View\render_widget_hooks().

gravityview_get_current_view_data (   $view_id = 0)

Get data for a specific view.

See also
GravityView_View_Data::get_view()
Returns
array View data with id, view_id, form_id, template_id, atts, fields, widgets, form keys.

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

References $view_id, and GravityView_frontend\getInstance().

Referenced by GravityView_Delete_Entry\check_user_cap_delete_entry(), and GravityView_View\render_widget_hooks().

gravityview_get_current_views ( )

Get all views processed so far for the current page load.

See also
GravityView_View_Data::add_view()
Returns
array Array of View data, each View data with id, view_id, form_id, template_id, atts, fields, widgets, form keys.

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

References GravityView_frontend\getInstance().

gravityview_get_field_value (   $entry,
  $field_id,
  $display_value 
)

Handle getting values for complex Gravity Forms fields.

If the field is complex, like a product, the field ID, for example, 11, won't exist. Instead, it will be 11.1, 11.2, and 11.3. This handles being passed 11 and 11.2 with the same function.

Since
1.0.4
Parameters
array$entryGF entry array
string$field_id[description]
string$display_valueThe value generated by Gravity Forms
Returns
string Value

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

References $entry, and $field_id.

gravityview_get_files_array (   $value,
  $gv_class = '' 
)

Return an array of files prepared for output.

Wrapper for GravityView_Field_FileUpload::get_files_array()

Processes files by file type and generates unique output for each.

Returns array for each file, with the following keys:

file_path => The file path of the file, with a line break html => The file output HTML formatted

See also
GravityView_Field_FileUpload::get_files_array()
Since
1.2
Parameters
string$valueField value passed by Gravity Forms. String of file URL, or serialized string of file URL array
string$gv_classField class to add to the output HTML
Returns
array Array of file output, with file_path and html keys (see comments above)

"GRAVITYVIEW_DIR" "../"

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

References $value, and GRAVITYVIEW_DIR.

gravityview_get_map_link (   $address)

Generate a mapping link from an address.

The address should be plain text with new line (\n) or <br /> line breaks separating sections

See also
https://gravityview.co/support/documentation/201608159 Read how to modify the link
Parameters
string$addressAddress
Returns
string URL of link to map of address
Runs Filter:
gravityview_map_link Modify the map link generated. You can use a different mapping service, for example.
Parameters
[in,out]string$linkMap link
[in]string$addressAddress to generate link for
[in]string$urlURL generated by the function

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

References $link_text, $url, and gravityview_get_link().

gravityview_get_the_term_list (   $post_id,
  $link = true,
  $taxonomy = 'post_tag' 
)

Get the links for post_tags and post_category output based on post ID.

Parameters
int$post_idThe ID of the post
boolean$linkAdd links or no?
string$taxonomyTaxonomy of term to fetch.
Returns
string String with terms

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

References $output.

gravityview_get_view_id ( )

Get the current View ID being rendered.

GravityView_View $gravityview_view

Returns
string View context "directory" or "single"

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

References GravityView_View\getInstance().

Referenced by GravityView_API\entry_link(), GravityView_Delete_Entry\get_delete_link(), gravityview_after(), gravityview_before(), gravityview_footer(), and gravityview_header().

gravityview_header ( )
Runs Actions:
gravityview_header Prepend content to the View container <div>
Parameters
int$view_idThe ID of the View being displayed

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

References gravityview_get_view_id().

gv_class (   $field,
  $form = NULL,
  $entry = array() 
)

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

References $entry, $field, $form, and GravityView_API\field_class().

Referenced by gravityview_field_output().

gv_container_class (   $passed_css_class = '',
  $echo = true 
)

Generate a CSS class to be added to the wrapper

of a View.

Since
1.5.4
1.16 Added $echo param
Parameters
string$passed_css_classDefault: gv-container gv-container-{view id}. If View is hidden until search, adds hidden
boolean$echoWhether to echo the output. Default: true
Returns
string CSS class, sanitized by gravityview_sanitize_html_class()
Runs Filter:
gravityview/render/container/class Modify the CSS class to be added to the wrapper
of a View
Since
1.5.4
Parameters
[in,out]string$css_classDefault: gv-container gv-container-{view id}. If View is hidden until search, adds hidden. If the View has no results, adds gv-container-no-results

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

References $view_id, and GravityView_View\getInstance().

gv_directory_link (   $post = NULL,
  $add_pagination = true 
)
gv_entry_link (   $entry,
  $post_id = NULL 
)

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

References $entry, and GravityView_API\entry_link().

Referenced by GravityView_Edit_Entry\get_edit_link().

gv_label (   $field,
  $entry = NULL 
)

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

References $entry, $field, and GravityView_API\field_label().

Referenced by gravityview_field_output().

gv_no_results (   $wpautop = true)

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

References GravityView_API\no_results().

Referenced by GravityView_Entry_List\__construct().

gv_value (   $entry,
  $field 
)
Runs Filter:
gravityview_empty_value What to display when a field is empty
Parameters
string$value(empty string)

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

References $entry, $field, $value, and GravityView_API\field_value().

Referenced by gravityview_field_output().