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

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

Inheritance diagram for View_Collection:
Collection

Public Member Functions

 add ( $view)
 Add a to this collection. More...
 
 all ()
 
 contains ( $view_id)
 Check whether with an ID is already here. More...
 
 get ( $view_id)
 Get a from this list. More...
 
- Public Member Functions inherited from Collection
 add ( $value)
 Add an object to this collection. More...
 
 all ()
 Returns all the objects in this collection as an an array. More...
 
 clear ()
 Clear this collection. More...
 
 count ()
 Returns the count of the objects in this collection. More...
 
 first ()
 Get the first added object. More...
 
 last ()
 Get the last added object. More...
 
 merge (\GV\Collection $collection)
 Merge another collection into here. More...
 

Static Public Member Functions

static from_content ( $content)
 Get a list of detected objects inside the supplied content. More...
 
static from_post (\WP_Post $post)
 Get a list of objects inside the supplied . More...
 

Static Private Member Functions

static merge_deep ( $views, $meta_value)
 Process meta values when stored singular (string) or multiple (array). More...
 

Detailed Description

If this file is called directly, abort.

A collection of objects.

Definition at line 12 of file class-gv-collection-view.php.

Member Function Documentation

◆ add()

add (   $view)

Add a to this collection.

Parameters
\GV\View$viewThe view to add to the internal array.
Since
2.0
Returns
void

Definition at line 31 of file class-gv-collection-view.php.

References gravityview().

◆ all()

all ( )

Returns
View[]

Definition at line 18 of file class-gv-collection-view.php.

◆ contains()

contains (   $view_id)

Check whether with an ID is already here.

Parameters
int$view_idThe ID of the view to check.
Since
2.0
Returns
boolean Whether it exists or not.

Definition at line 70 of file class-gv-collection-view.php.

References $view_id.

◆ from_content()

static from_content (   $content)
static

Get a list of detected objects inside the supplied content.

The content can have a shortcode, this is the simplest case.

Parameters
string$contentThe content to look into.
Since
2.0
Returns
A instance containing the views inside the supplied .

Let's find us some [gravityview] shortcodes perhaps.

Definition at line 166 of file class-gv-collection-view.php.

References $content.

Referenced by GravityView_frontend\detect_views_in_block_content().

◆ from_post()

static from_post ( \WP_Post  $post)
static

Get a list of objects inside the supplied .

The post can be a gravityview post, which is the simplest case. The post can contain gravityview shortcodes as well. The post meta can contain gravityview shortcodes.

Parameters
\WP_Post$postThe object to look into.
Since
2.0
Returns
A instance containing the views inside the supplied .

A straight up gravityview post.

Runs Filter:
gravityview/view_collection/from_post/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.

Since
2.0
2.0.7 Added $views parameter, passed by reference
Parameters
array$meta_keysArray of key values to check. If empty, do not check. Default: empty array
\WP_Post$postThe post that is being checked
\GV\View_Collection$viewsThe current View Collection object, passed as reference
Runs Filter:
gravityview/data/parse/meta_keys
See also
The gravityview/view_collection/from_post/meta_keys filter.

What about inside post meta values?

Definition at line 87 of file class-gv-collection-view.php.

Referenced by GravityView_API\entry_link(), GravityView_View_Data\is_valid_embed_id(), GravityView_Edit_Entry_Locking\maybe_enqueue_scripts(), GravityView_View_Data\maybe_get_view_id(), Views_Route\prepare_entry_for_response(), and GravityView_frontend\single_entry_title().

◆ get()

get (   $view_id)

Get a from this list.

Parameters
int$view_idThe ID of the view to get.
Since
2.0
Returns
|null The with the $view_id as the ID, or null if not found.

Definition at line 51 of file class-gv-collection-view.php.

References $view_id.

◆ merge_deep()

static merge_deep (   $views,
  $meta_value 
)
staticprivate

Process meta values when stored singular (string) or multiple (array).

Supports nested arrays and JSON strings.

Since
2.1
Parameters
\GV\View_Collection$viewsExisting View Collection to merge with
string | array$meta_valueValue to parse. Normally the value of $post->{$meta_key}.
Returns
$views View Collection containing any additional Views found

Definition at line 138 of file class-gv-collection-view.php.

References gv_maybe_json_decode().


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