GravityView  2.1.1
The best, easiest way to display Gravity Forms entries on your website.
Public Member Functions | Static Public Member Functions | Data Fields | Static Public 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...
 

Data Fields

 $views = array()
 

Static Public Attributes

static $instance = NULL
 

Private Member Functions

 __construct ( $passed_post=NULL)
 

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

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

References $view_id, 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)
See also
::append
Returns
array|false All views if $view_id is array, a view data array if $view_id is an int, false on errors.

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

References $view_id, and GV\Mocks\GravityView_View_Data_add_view().

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

References View_Settings\defaults().

◆ 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.
See also
defaults()

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

References GV\defaults().

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

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

References $view_id, and View\by_id().

◆ get_id_from_atts()

get_id_from_atts (   $atts)

Retrieves view ID from an array.

Parameters
array$atts
Returns
int|null A view ID cast to int, or null.

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

References $view_id, and View_Settings\with_defaults().

Referenced by maybe_get_view_id().

◆ get_view()

get_view (   $view_id,
  $atts = NULL 
)
See also
get()

Emulate this weird side-effect below...

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

References $view_id, and View\by_id().

◆ get_views()

get_views ( )
See also
all()

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

◆ getInstance()

static getInstance (   $passed_post = NULL)
static

◆ has_multiple_views()

has_multiple_views ( )
See also
::count
Returns
boolean

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

◆ 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.

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

References $post, $view_id, $views, View_Collection\from_post(), 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
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.

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

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

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

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

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

References $content.

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

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

References $view_id.

Field Documentation

◆ $instance

$instance = NULL
static

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

Referenced by Legacy_Context\reset().

◆ $views

$views = array()

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

Referenced by is_valid_embed_id(), and maybe_get_view_id().


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