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

If this file is called directly, abort. More...

Public Member Functions

 add_view ($view_id, $atts=NULL)
 Add a view to the views array. More...
 
 get_fields ($view_id)
 Get the visible fields for a View gravityview_get_directory_fields() Fetch the configured fields for a View GravityView_View_Data::filter_fields() Only show visible fields. More...
 
 get_id_from_atts ($atts)
 
 get_view ($view_id, $atts=NULL)
 
 get_views ()
 
 has_multiple_views ()
 
 maybe_get_view_id ($passed_post)
 Figure out what the View ID is for a variable, if any. More...
 
 parse_post_content ($content)
 Parse content to determine if there is a GV shortcode to allow for enqueing necessary files in the head. More...
 
 view_exists ($view_id)
 Determines if a post, identified by the specified ID, exist within the WordPress database. More...
 

Static Public Member Functions

static get_default_arg ($key, $with_details=false)
 Get a specific default setting. More...
 
static get_default_args ($with_details=false, $group=NULL)
 Retrieve the default args for shortcode and theme function. More...
 
static getInstance ($passed_post=NULL)
 
static is_valid_embed_id ($post_id= '', $view_id= '', $empty_is_valid=true)
 Checks if the passed post id has the passed View id embedded. More...
 

Static Public Attributes

static $instance = NULL
 

Protected Attributes

 $views = array()
 

Private Member Functions

 __construct ($passed_post=NULL)
 
 filter_fields ($dir_fields)
 Filter area fields based on specified conditions. More...
 
 hide_field_check_conditions ($properties)
 Check whether a certain field should not be presented based on its own properties. More...
 
 parse_post_meta ($post_id)
 Parse specific custom fields (Post Meta) to determine if there is a GV shortcode to allow for enqueuing necessary files in the head. More...
 

Detailed Description

If this file is called directly, abort.

Definition at line 8 of file class-data.php.

Constructor & Destructor Documentation

__construct (   $passed_post = NULL)
private
Parameters
null$passed_post

Definition at line 18 of file class-data.php.

References add_view(), and maybe_get_view_id().

Member Function Documentation

add_view (   $view_id,
  $atts = NULL 
)

Add a view to the views array.

Parameters
int | array$view_idView ID or array of View IDs
array | string$attsCombine other attributes (eg. from shortcode) with the view settings (optional)
Returns
array

Definition at line 174 of file class-data.php.

References $form_id, $view_id, $view_settings, $views, get_fields(), gravityview_get_directory_widgets(), gravityview_get_form(), gravityview_get_form_id(), gravityview_get_template_id(), gravityview_get_template_settings(), and view_exists().

Referenced by __construct(), get_view(), and parse_post_content().

filter_fields (   $dir_fields)
private

Filter area fields based on specified conditions.

public

Parameters
array$dir_fields
Returns
array

Definition at line 278 of file class-data.php.

References hide_field_check_conditions().

Referenced by get_fields().

static get_default_arg (   $key,
  $with_details = false 
)
static

Get a specific default setting.

Parameters
string$keyThe key of the setting array item
boolean$with_detailsInclude details
Returns
mixed|array If using $with_details, return array. Otherwise, mixed.

Definition at line 518 of file class-data.php.

Referenced by GravityView_Render_Settings\render_field_options().

static get_default_args (   $with_details = false,
  $group = NULL 
)
static

Retrieve the default args for shortcode and theme function.

Parameters
boolean$with_detailsTrue: Return array with full default settings information, including description, name, etc. False: Return an array with only key => value pairs.
string$groupOnly fetch
Returns
array $args Associative array of default settings for a View
Parameters
[out]string$labelSetting label shown in admin
[out]string$typeGravity Forms field type
[out]string$groupThe field group the setting is associated with. Default: "default"
[out]mixed$valueThe default value for the setting
[out]string$tooltipTooltip displayed for the setting
[out]boolean$show_in_shortcodeWhether to show the setting in the shortcode configuration modal
[out]array$optionsArray of values to use when generating select, multiselect, radio, or checkboxes fields
[out]boolean$full_widthTrue: Display the input and label together when rendering. False: Display label and input in separate columns when rendering.
Runs Filter:
gravityview_default_args Modify the default settings for new Views
Parameters
[in,out]array$default_argsArray of default args.

Definition at line 543 of file class-data.php.

References $value.

Referenced by GravityView_Admin_Add_Shortcode\add_shortcode_popup(), get_gravityview(), GVCommon\get_template_settings(), GravityView_Shortcode\parse_and_sanitize_atts(), and GravityView_Admin_Views\tooltips().

get_fields (   $view_id)

Get the visible fields for a View gravityview_get_directory_fields() Fetch the configured fields for a View GravityView_View_Data::filter_fields() Only show visible fields.

Parameters
int$view_idView ID
Returns
array Array of fields as passed by gravityview_get_directory_fields()

Definition at line 259 of file class-data.php.

References $view_id, filter_fields(), and gravityview_get_directory_fields().

Referenced by add_view().

get_id_from_atts (   $atts)

Definition at line 317 of file class-data.php.

References $view_id.

Referenced by maybe_get_view_id().

get_view (   $view_id,
  $atts = NULL 
)

Definition at line 132 of file class-data.php.

References $view_id, and add_view().

get_views ( )

Definition at line 128 of file class-data.php.

References $views.

Referenced by has_multiple_views().

static getInstance (   $passed_post = NULL)
static
has_multiple_views ( )
Returns
boolean

Definition at line 34 of file class-data.php.

References get_views().

hide_field_check_conditions (   $properties)
private

Check whether a certain field should not be presented based on its own properties.

public

Parameters
array$properties
Returns
boolean True: (field should be hidden) or False: (field should be presented)

Definition at line 307 of file class-data.php.

References GVCommon\has_cap().

Referenced by filter_fields().

static is_valid_embed_id (   $post_id = '',
  $view_id = '',
  $empty_is_valid = true 
)
static

Checks if the passed post id has the passed View id embedded.

Returns

Since
1.6.1
Parameters
string$post_idPost ID where the View is embedded
string$view_idView ID
Returns
bool|WP_Error If valid, returns true. If invalid, returns WP_Error containing error message.

Definition at line 452 of file class-data.php.

References $view_id, getInstance(), and gravityview_get_link().

Referenced by GravityView_Search_WP_Widget\update(), and GravityView_Recent_Entries_Widget\update().

maybe_get_view_id (   $passed_post)

Figure out what the View ID is for a variable, if any.

Can be:

  • WP_Post (Either a gravityview post type or not)
  • Multi-dimensional array of WP_Post objects
  • Array with view_id or id key(s) set
  • String of content that may include GravityView shortcode
  • Number representing the Post ID or View ID
Parameters
mixed$passed_postSee method description
Returns
int|null|array ID of the View. If there are multiple views in the content, array of IDs parsed.

Definition at line 55 of file class-data.php.

References $post, get_id_from_atts(), parse_post_content(), and parse_post_meta().

Referenced by __construct().

parse_post_content (   $content)

Parse content to determine if there is a GV shortcode to allow for enqueing necessary files in the head.

gravityview_has_shortcode_r() Check whether shortcode exists (recursively) shortcode_parse_atts() Parse each GV shortcode gravityview_get_template_settings() Get the settings for the View ID

Parameters
string$content$post->post_content content
Returns
int|null|array If a single View is found, the ID of the View. If there are multiple views in the content, array of IDs parsed. If not found, NULL

This is so that the shortcode is registered for the oEmbed preview in the Admin

Since
1.6

Definition at line 347 of file class-data.php.

References $content, $post, add_view(), gravityview_has_shortcode_r(), and GravityView_Shortcode.

Referenced by maybe_get_view_id(), and parse_post_meta().

parse_post_meta (   $post_id)
private

Parse specific custom fields (Post Meta) to determine if there is a GV shortcode to allow for enqueuing necessary files in the head.

Since
1.15.1 ::parse_post_content
Parameters
int$post_idWP_Post ID
Returns
int|null|array If a single View is found, the ID of the View. If there are multiple views in the content, array of IDs parsed. If not found, or meta not parsed, NULL
Runs Filter:
gravityview/data/parse/meta_keys Define meta keys to parse to check for GravityView shortcode content This is useful when using themes that store content that may contain shortcodes in custom post meta
Parameters
[in,out]array$meta_keysArray of key values to check. If empty, do not check. Default: empty array
[in]int$post_idID of the post being checked

Definition at line 403 of file class-data.php.

References parse_post_content().

Referenced by maybe_get_view_id().

view_exists (   $view_id)

Determines if a post, identified by the specified ID, exist within the WordPress database.

See also
http://tommcfarlin.com/wordpress-post-exists-by-id/ Fastest check available
Parameters
int$view_idThe ID of the post to check
Returns
bool True if the post exists; otherwise, false.
Since
1.0.0

Definition at line 162 of file class-data.php.

References $view_id.

Referenced by add_view().

Field Documentation

$instance = NULL
static

Definition at line 10 of file class-data.php.

$views = array()
protected

Definition at line 12 of file class-data.php.

Referenced by add_view(), and get_views().


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