GV\View_Collection
A collection of \GV\View objects.
Source: future/includes/class-gv-collection-view.php:14
Details
- Kind:
class - Namespace:
GV - Extends:
Collection
Methods
| Method | Description |
|---|---|
all() | Returns all the objects in this collection as an an array. |
add() | Add a \GV\View to this collection. |
get() | Get a \GV\View from this list. |
contains() | Check whether \GV\View with an ID is already here. |
from_post() | Get a list of \GV\View objects inside the supplied \WP_Post. |
from_content() | Get a list of detected \GV\View objects inside the supplied content. |
Method Reference
all()
public function all()
Returns all the objects in this collection as an an array.
Returns
View[]
Since: 2.0
Source: future/includes/class-gv-collection-view.php:20
add()
public function add( $view )
Add a \GV\View to this collection.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$view | \GV\View | The view to add to the internal array. |
Returns
void
Since: 2.0
Source: future/includes/class-gv-collection-view.php:33
get()
public function get( $view_id )
Get a \GV\View from this list.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$view_id | int | The ID of the view to get. |
Returns
- \GV\View |
null— The \GV\View with the $view_id as the ID, or null if not found.
Since: 2.0
Source: future/includes/class-gv-collection-view.php:53
contains()
public function contains( $view_id )
Check whether \GV\View with an ID is already here.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$view_id | int | The ID of the view to check. |
Returns
boolean— Whether it exists or not.
Since: 2.0
Source: future/includes/class-gv-collection-view.php:72
from_post()
public static function from_post( \WP_Post $post )
Get a list of \GV\View objects inside the supplied \WP_Post.
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
| Name | Type | Default | Description |
|---|---|---|---|
$post | \WP_Post | The \WP_Post object to look into. |
Returns
- \GV\View_Collection — A \GV\View_Collection instance containing the views inside the supplied \WP_Post.
Since: 2.0
Source: future/includes/class-gv-collection-view.php:89
from_content()
public static function from_content( $content )
Get a list of detected \GV\View objects inside the supplied content.
The content can have a shortcode, this is the simplest case.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$content | string | The content to look into. |
Returns
- \GV\View_Collection — A \GV\View_Collection instance containing the views inside the supplied \WP_Post.
Since: 2.0
Source: future/includes/class-gv-collection-view.php:188