Skip to main content

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

MethodDescription
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

NameTypeDefaultDescription
$view\GV\ViewThe 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

NameTypeDefaultDescription
$view_idintThe 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

NameTypeDefaultDescription
$view_idintThe 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

NameTypeDefaultDescription
$post\WP_PostThe \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

NameTypeDefaultDescription
$contentstringThe 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