GravityView  1.22.6
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)
 Retrieves view ID from an array. More...
 
 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=false)
 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()

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

Reset the new frontend request views, since we now have duplicate state.

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

References $view_id, add_view(), gravityview(), and maybe_get_view_id().

Member Function Documentation

◆ add_view()

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)
Deprecated:
See also
::append with the request available via gravityview()->request->views or the gravityview()->views shortcut.
Returns
array|false All views if $view_id is array, a view data array if $view_id is an int, false on errors.

Deprecated. Do not edit.

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

References $form_id, $view_id, $view_settings, get_fields(), get_views(), gravityview_get_directory_widgets(), gravityview_get_form(), gravityview_get_form_id(), gravityview_get_template_id(), gravityview_get_template_settings(), GV\Mocks\GravityView_View_Data_add_view(), and view_exists().

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

◆ filter_fields()

filter_fields (   $dir_fields)
private

Filter area fields based on specified conditions.

Deprecated:
Parameters
array$dir_fields
Returns
array

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

References hide_field_check_conditions().

Referenced by get_fields().

◆ get_default_arg()

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 685 of file class-data.php.

References View_Settings\defaults().

Referenced by GravityView_Render_Settings\render_field_options().

◆ get_default_args()

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.
Deprecated:
See also
::defaults()
Runs Filter:
gravityview_default_args Modify the default settings for new Views
Parameters
[in,out]array$default_argsArray of default args.
Deprecated:
See also
filter gravityview/view/settings/defaults

Definition at line 713 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()

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
Deprecated:
See also
::$fields
Returns
array|null Array of fields as passed by gravityview_get_directory_fields()

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

References $view_id, View\by_id(), filter_fields(), and gravityview_get_directory_fields().

Referenced by add_view().

◆ get_id_from_atts()

get_id_from_atts (   $atts)

Retrieves view ID from an array.

Parameters
array$atts
Deprecated:
Dead code, was probably superceded by GravityView_View_Data::parse_post_content
Returns
int|null A view ID cast to int, or null.

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

References $view_id.

Referenced by maybe_get_view_id().

◆ get_view()

get_view (   $view_id,
  $atts = NULL 
)
Deprecated:
See also
::get() via gravityview()->views or gravityview()->request->views.

Emulate this weird side-effect below...

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

References $view_id, add_view(), View\by_id(), and gravityview().

◆ get_views()

get_views ( )
Deprecated:
See also
::all() via gravityview()->views or gravityview()->request->views.

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

References $views, and gravityview().

Referenced by add_view(), and has_multiple_views().

◆ getInstance()

static getInstance (   $passed_post = NULL)
static

◆ has_multiple_views()

has_multiple_views ( )
Deprecated:
See also
::count via gravityview()->request->views->count() or gravityview()->views->count()
Returns
boolean

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

References get_views(), and gravityview().

◆ hide_field_check_conditions()

hide_field_check_conditions (   $properties)
private

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

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

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

References GVCommon\has_cap().

Referenced by filter_fields().

◆ is_valid_embed_id()

static is_valid_embed_id (   $post_id = '',
  $view_id = '',
  $empty_is_valid = false 
)
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
string$empty_is_validIf either $post_id or $view_id is empty consider valid. Default: false.
Returns
bool|WP_Error If valid, returns true. If invalid, returns WP_Error containing error message.

::maybe_get_view_id deprecated.

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

References $post, $view_id, $views, View_Collection\from_post(), getInstance(), and gravityview_get_link().

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

◆ maybe_get_view_id()

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
Deprecated:
See also
::from_post and ::parse
Returns
int|null|array ID of the View. If there are multiple views in the content, array of IDs parsed.

And as a side-effect... add each view to the global scope.

Deprecated, see ::from_post

And as a side-effect... add each view to the global scope.

Deprecated, use ::parse.

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

References $post, $views, View\exists(), View_Collection\from_post(), get_id_from_atts(), gravityview(), Shortcode\parse(), parse_post_content(), and parse_post_meta().

Referenced by __construct().

◆ parse_post_content()

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
Deprecated:
See also
::from_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

The original function outputs the ID even though it wasn't added by ::add_view() Wether this is a bug or not remains a mystery. But we need to emulate this behavior until better times.

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

Since
1.6

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

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

Referenced by maybe_get_view_id(), and parse_post_meta().

◆ 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
Deprecated:
See also
::from_post

::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

Is private and no longer used in future mode.

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 559 of file class-data.php.

References parse_post_content().

Referenced by maybe_get_view_id().

◆ view_exists()

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
Deprecated:
See also
::exists()
Returns
bool True if the post exists; otherwise, false.
Since
1.0.0

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

References $view_id.

Referenced by add_view().

Field Documentation

◆ $instance

$instance = NULL
static

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

◆ $views

$views = array()
protected

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

Referenced by get_views(), is_valid_embed_id(), and maybe_get_view_id().


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