Skip to main content

GV\Widget_Collection

A collection of \GV\Widget objects.

Source: future/includes/class-gv-collection-widget.php:13

Details

  • Kind: class
  • Namespace: GV
  • Extends: Collection
  • Implements: Collection_Position_Aware

Methods

MethodDescription
add()Add a \GV\Widet to this collection.
get()Get a \GV\Widget from this list by UID.
by_position()Get a copy of this \GV\Widget_Collection filtered by position.
by_id()Get a copy of this \GV\Widget_Collection filtered by ID.
from_configuration()Parse a configuration array into a Widget_Collection.
as_configuration()Return a configuration array for this widget collection.

Method Reference

add()

public function add( $widget )

Add a \GV\Widet to this collection.

Parameters

NameTypeDefaultDescription
$widget\GV\WidgetThe widget to add to the internal array.

Returns

  • void

Since: 2.0

Source: future/includes/class-gv-collection-widget.php:23

get()

public function get( $widget_uid )

Get a \GV\Widget from this list by UID.

Parameters

NameTypeDefaultDescription
$widget_uidintThe UID of the widget in the collection to get.

Returns

  • \GV\Widget | null — The \GV\Widget with the $widget_uid as the UID, or null if not found.

Since: 2.0

Source: future/includes/class-gv-collection-widget.php:41

by_position()

public function by_position( $position )

Get a copy of this \GV\Widget_Collection filtered by position.

Parameters

NameTypeDefaultDescription
$positionstringThe position to get the widgets for. Can be a wildcard *

Returns

Source: future/includes/class-gv-collection-widget.php:61

by_id()

public function by_id( $id )

Get a copy of this \GV\Widget_Collection filtered by ID.

Parameters

NameTypeDefaultDescription
$idstringThe IDs to get the widgets for.

Returns

Source: future/includes/class-gv-collection-widget.php:84

from_configuration()

public static function from_configuration( $configuration )

Parse a configuration array into a Widget_Collection.

Parameters

NameTypeDefaultDescription
$configurationarrayThe configuration, structured like so: array( [other zones] 'footer_right' => array( [other widgets] '5372653f25d44' => array(

Returns

See Also

  • \GV\Widget::as_configuration() for structure ) [other widgets] ) [other zones] )

Source: future/includes/class-gv-collection-widget.php:120

as_configuration()

public function as_configuration()

Return a configuration array for this widget collection.

Returns

  • array — See \GV\Widget_Collection::from_configuration() for structure.

Source: future/includes/class-gv-collection-widget.php:147