PageCollectionInterface
extends
Traversable, ArrayAccess, Countable, Serializable
in
Interface PageCollectionInterface
Tags
Table of Contents
Methods
- addPage() : $this
- Add a single page to a collection
- adjacentSibling() : PageInterface|PageCollectionInterface|false
- Returns the adjacent sibling based on a direction.
- batch() : array<string|int, PageCollectionInterface>
- Split collection into array of smaller collections.
- copy() : static
- Create a copy of this collection
- currentPosition() : int|null
- Returns the item in the current position.
- dateRange() : PageCollectionInterface
- Returns the items between a set of date ranges of either the page date field (default) or an arbitrary datetime page field where start date and end date are optional Dates must be passed in as text that strtotime() can process http://php.net/manual/en/function.strtotime.php
- intersect() : PageCollectionInterface
- Intersect another collection with the current collection
- isFirst() : bool
- Check to see if this item is the first in the collection.
- isLast() : bool
- Check to see if this item is the last in the collection.
- merge() : PageCollectionInterface
- Merge another collection with the current collection
- modular() : PageCollectionInterface
- Creates new collection with only modules
- modules() : PageCollectionInterface
- Creates new collection with only modules
- nextSibling() : PageInterface
- Gets the next sibling based on current position.
- nonModular() : PageCollectionInterface
- Creates new collection with only non-module pages
- nonPublished() : PageCollectionInterface
- Creates new collection with only non-published pages
- nonRoutable() : PageCollectionInterface
- Creates new collection with only non-routable pages
- nonVisible() : PageCollectionInterface
- Creates new collection with only non-visible pages
- ofOneOfTheseAccessLevels() : PageCollectionInterface
- Creates new collection with only pages of one of the specified access levels
- ofOneOfTheseTypes() : PageCollectionInterface
- Creates new collection with only pages of one of the specified types
- ofType() : PageCollectionInterface
- Creates new collection with only pages of the specified type
- order() : PageCollectionInterface
- Reorder collection.
- pages() : PageCollectionInterface
- Creates new collection with only pages
- params() : array<string|int, mixed>
- Get the collection params
- prevSibling() : PageInterface
- Gets the previous sibling based on current position.
- published() : PageCollectionInterface
- Creates new collection with only published pages
- routable() : PageCollectionInterface
- Creates new collection with only routable pages
- setParams() : $this
- Set parameters to the Collection
- toArray() : array<string|int, mixed>
- Converts collection into an array.
- toExtendedArray() : array<string|int, mixed>
- Get the extended version of this Collection with each page keyed by route
- visible() : PageCollectionInterface
- Creates new collection with only visible pages
Methods
addPage()
Add a single page to a collection
public
addPage(PageInterface $page) : $this
Parameters
- $page : PageInterface
Return values
$thisadjacentSibling()
Returns the adjacent sibling based on a direction.
public
adjacentSibling(string $path[, int $direction = 1 ]) : PageInterface|PageCollectionInterface|false
Parameters
- $path : string
- $direction : int = 1
-
either -1 or +1
Tags
Return values
PageInterface|PageCollectionInterface|false —The sibling item.
batch()
Split collection into array of smaller collections.
public
batch(int $size) : array<string|int, PageCollectionInterface>
Parameters
- $size : int
Tags
Return values
array<string|int, PageCollectionInterface>copy()
Create a copy of this collection
public
copy() : static
Return values
staticcurrentPosition()
Returns the item in the current position.
public
currentPosition(string $path) : int|null
Parameters
- $path : string
-
the path the item
Return values
int|null —The index of the current page, null if not found.
dateRange()
Returns the items between a set of date ranges of either the page date field (default) or an arbitrary datetime page field where start date and end date are optional Dates must be passed in as text that strtotime() can process http://php.net/manual/en/function.strtotime.php
public
dateRange([string|null $startDate = null ][, string|null $endDate = null ][, string|null $field = null ]) : PageCollectionInterface
Parameters
- $startDate : string|null = null
- $endDate : string|null = null
- $field : string|null = null
Tags
Return values
PageCollectionInterfaceintersect()
Intersect another collection with the current collection
public
intersect(PageCollectionInterface $collection) : PageCollectionInterface
Parameters
- $collection : PageCollectionInterface
Tags
Return values
PageCollectionInterfaceisFirst()
Check to see if this item is the first in the collection.
public
isFirst(string $path) : bool
Parameters
- $path : string
Return values
bool —True if item is first.
isLast()
Check to see if this item is the last in the collection.
public
isLast(string $path) : bool
Parameters
- $path : string
Return values
bool —True if item is last.
merge()
Merge another collection with the current collection
public
merge(PageCollectionInterface $collection) : PageCollectionInterface
Parameters
- $collection : PageCollectionInterface
Tags
Return values
PageCollectionInterfacemodular()
Creates new collection with only modules
public
modular() : PageCollectionInterface
Use $this->modules() instead
Tags
Return values
PageCollectionInterface —The collection with only modules
modules()
Creates new collection with only modules
public
modules() : PageCollectionInterface
Tags
Return values
PageCollectionInterface —The collection with only modules
nextSibling()
Gets the next sibling based on current position.
public
nextSibling(string $path) : PageInterface
Parameters
- $path : string
Tags
Return values
PageInterface —The next item.
nonModular()
Creates new collection with only non-module pages
public
nonModular() : PageCollectionInterface
Use $this->pages() instead
Tags
Return values
PageCollectionInterface —The collection with only non-module pages
nonPublished()
Creates new collection with only non-published pages
public
nonPublished() : PageCollectionInterface
Tags
Return values
PageCollectionInterface —The collection with only non-published pages
nonRoutable()
Creates new collection with only non-routable pages
public
nonRoutable() : PageCollectionInterface
Tags
Return values
PageCollectionInterface —The collection with only non-routable pages
nonVisible()
Creates new collection with only non-visible pages
public
nonVisible() : PageCollectionInterface
Tags
Return values
PageCollectionInterface —The collection with only non-visible pages
ofOneOfTheseAccessLevels()
Creates new collection with only pages of one of the specified access levels
public
ofOneOfTheseAccessLevels(array<string|int, mixed> $accessLevels) : PageCollectionInterface
Parameters
- $accessLevels : array<string|int, mixed>
Tags
Return values
PageCollectionInterface —The collection
ofOneOfTheseTypes()
Creates new collection with only pages of one of the specified types
public
ofOneOfTheseTypes(array<string|int, string> $types) : PageCollectionInterface
Parameters
- $types : array<string|int, string>
Tags
Return values
PageCollectionInterface —The collection
ofType()
Creates new collection with only pages of the specified type
public
ofType(string $type) : PageCollectionInterface
Parameters
- $type : string
Tags
Return values
PageCollectionInterface —The collection
order()
Reorder collection.
public
order(string $by[, string $dir = 'asc' ][, array<string|int, mixed>|null $manual = null ][, string|null $sort_flags = null ]) : PageCollectionInterface
Parameters
- $by : string
- $dir : string = 'asc'
- $manual : array<string|int, mixed>|null = null
- $sort_flags : string|null = null
Tags
Return values
PageCollectionInterfacepages()
Creates new collection with only pages
public
pages() : PageCollectionInterface
Tags
Return values
PageCollectionInterface —The collection with only pages
params()
Get the collection params
public
params() : array<string|int, mixed>
Return values
array<string|int, mixed>prevSibling()
Gets the previous sibling based on current position.
public
prevSibling(string $path) : PageInterface
Parameters
- $path : string
Tags
Return values
PageInterface —The previous item.
published()
Creates new collection with only published pages
public
published() : PageCollectionInterface
Tags
Return values
PageCollectionInterface —The collection with only published pages
routable()
Creates new collection with only routable pages
public
routable() : PageCollectionInterface
Tags
Return values
PageCollectionInterface —The collection with only routable pages
setParams()
Set parameters to the Collection
public
setParams(array<string|int, mixed> $params) : $this
Parameters
- $params : array<string|int, mixed>
Return values
$thistoArray()
Converts collection into an array.
public
toArray() : array<string|int, mixed>
Return values
array<string|int, mixed>toExtendedArray()
Get the extended version of this Collection with each page keyed by route
public
toExtendedArray() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed>visible()
Creates new collection with only visible pages
public
visible() : PageCollectionInterface
Tags
Return values
PageCollectionInterface —The collection with only visible pages