Documentation

PageIndex extends FlexPageIndex implements PageCollectionInterface uses FlexGravTrait, FlexIndexTrait

Class GravPageObject

Tags
template
template
extends
implements

Table of Contents

Interfaces

PageCollectionInterface
Interface PageCollectionInterface

Constants

ORDER_LIST_REGEX  = '/(\/\d+)\.[^\/]+/u'
ORDER_PREFIX_REGEX  = '/^\d+\./u'
PAGE_ROUTE_REGEX  = '/\/\d+\./u'
VERSION  = parent::VERSION . '.5'

Properties

$_key  : string
$_params  : array<string|int, mixed>|null
$_root  : PageObject|array<string|int, mixed>
$type  : string

Methods

__call()  : mixed
__construct()  : mixed
Initializes a new FlexIndex.
__debugInfo()  : array<string|int, mixed>
__serialize()  : array<string|int, mixed>
__toString()  : string
Returns a string representation of this object.
__unserialize()  : void
add()  : mixed
{@inheritDoc}
addPage()  : PageCollection
Add a single page to a collection
adjacentSibling()  : PageObject|false
Returns the adjacent sibling based on a direction.
all()  : $this
Mimicks Pages class.
batch()  : array<string|int, PageCollection>
Split collection into array of smaller collections.
call()  : array<string|int, mixed>|mixed
chunk()  : array<string|int, mixed>
Split collection into chunks.
clear()  : mixed
{@inheritDoc}
collectionGroup()  : array<string|int, ObjectCollectionInterface>
Group items in the collection by a field and return them as associated array of collections.
contains()  : mixed
{@inheritDoc}
containsKey()  : mixed
{@inheritDoc}
copy()  : static
Create a copy of this collection
count()  : mixed
{@inheritDoc}
createFromArray()  : static
Creates a Flex Collection from an array.
createFromStorage()  : static
Helper method to create Flex Index.
current()  : mixed
{@inheritDoc}
currentPosition()  : int|null
Returns the item in the current position.
dateRange()  : static
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
defNestedProperty()  : ObjectCollectionInterface
defProperty()  : ObjectCollectionInterface
exists()  : mixed
{@inheritDoc}
filter()  : mixed
{@inheritDoc}
filterBy()  : static
Filter pages by given filters.
first()  : mixed
{@inheritDoc}
forAll()  : mixed
{@inheritDoc}
get()  : PageObject|null
{@inheritDoc}
getCache()  : CacheInterface
getCacheChecksum()  : string
Get cache checksum for the object / collection.
getCacheKey()  : string
Get a cache key which is used for caching the object / collection.
getCollection()  : FlexCollectionInterface
Load all the objects into memory,
getFlexDirectory()  : FlexDirectory
Get Flex Directory for the object / collection.
getFlexFeatures()  : array<string|int, mixed>
Get full list of features the object / collection implements.
getFlexKeys()  : array<string|int, string>
Get Flex keys from all the objects in the collection.
getFlexType()  : string
Get Flex Type of the object / collection.
getIndex()  : FlexIndexInterface
Get Flex Index from the Flex Collection.
getIndexMap()  : array<string|int, mixed>
getIterator()  : mixed
Required by interface IteratorAggregate.
getKey()  : string
getKeyField()  : string
getKeys()  : mixed
{@inheritDoc}
getLanguage()  : string|null
getLevelListing()  : array<string|int, mixed>
getMetaData()  : array<string|int, mixed>
Get metadata associated to the object
getNestedProperty()  : array<string|int, mixed>
getObjectKeys()  : array<string|int, mixed>
getParam()  : mixed
Get the collection param
getParams()  : array<string|int, mixed>
Get the collection params
getProperty()  : array<string|int, mixed>
getRoot()  : PageInterface
getStorageKeys()  : array<string|int, string>
Get storage keys from all the objects in the collection.
getTimestamp()  : int
Get last updated timestamp for the object / collection.
getTimestamps()  : array<string|int, int>
Get timestamps from all the objects in the collection.
getType()  : string
getValues()  : mixed
{@inheritDoc}
group()  : array<string|int, mixed>
Group items in the collection by a field and return them as associated array.
hasFlexFeature()  : bool
Test whether the feature is implemented in the object / collection.
hasNestedProperty()  : array<string|int, bool>
hasProperty()  : array<string|int, bool>
indexOf()  : mixed
{@inheritDoc}
intersect()  : PageCollection
Intersect another collection with the current collection
isEmpty()  : mixed
{@inheritDoc}
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.
jsonSerialize()  : array<string|int, mixed>
Implements JsonSerializable interface.
key()  : mixed
{@inheritDoc}
last()  : mixed
{@inheritDoc}
limit()  : static
loadEntriesFromStorage()  : array<string|int, mixed>
Method to load index from the object storage, usually filesystem.
map()  : mixed
{@inheritDoc}
matching()  : ObjectCollectionInterface
merge()  : PageCollection
Merge another collection with the current collection
modular()  : static
Creates new collection with only modular pages
modules()  : static
Creates new collection with only modular pages
next()  : mixed
{@inheritDoc}
nextSibling()  : PageObject|null
Gets the next sibling based on current position.
nonModular()  : static
Creates new collection with only non-modular pages
nonPublished()  : static
Creates new collection with only non-published pages
nonRoutable()  : static
Creates new collection with only non-routable pages
nonVisible()  : static
Creates new collection with only non-visible pages
offsetExists()  : bool
Required by interface ArrayAccess.
offsetGet()  : mixed
Required by interface ArrayAccess.
offsetSet()  : void
Required by interface ArrayAccess.
offsetUnset()  : void
Required by interface ArrayAccess.
ofOneOfTheseAccessLevels()  : static
Creates new collection with only pages of one of the specified access levels
ofOneOfTheseTypes()  : static
Creates new collection with only pages of one of the specified types
ofType()  : static
Creates new collection with only pages of the specified type
order()  : static
Reorder collection.
orderBy()  : static
pages()  : static
Creates new collection with only non-modular pages
params()  : array<string|int, mixed>
Get the collection params
partition()  : mixed
{@inheritDoc}
prevSibling()  : PageObject|null
Gets the previous sibling based on current position.
published()  : static
Creates new collection with only published pages
remove()  : PageObject|null
Remove item from the list.
removeElement()  : mixed
{@inheritDoc}
render()  : ContentBlockInterface|HtmlBlock
Renders the object.
reverse()  : static
Reverse the order of the items.
routable()  : static
Creates new collection with only routable pages
search()  : FlexCollectionInterface
Search a string from the collection.
select()  : static
Select items from collection.
serialize()  : string
set()  : mixed
{@inheritDoc}
setKey()  : $this
setNestedProperty()  : ObjectCollectionInterface
setParam()  : $this
Set a parameter to the Collection
setParams()  : $this
Set parameters to the Collection
setProperty()  : ObjectCollectionInterface
shuffle()  : static
Shuffle items.
slice()  : mixed
{@inheritDoc}
sort()  : FlexCollectionInterface
Sort 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
unselect()  : static
Un-select items from collection.
unserialize()  : void
unsetNestedProperty()  : ObjectCollectionInterface
unsetProperty()  : ObjectCollectionInterface
updateObjectMeta()  : void
You can define indexes for fast lookup.
visible()  : static
Creates new collection with only visible pages
withKeyField()  : static
Return new collection with a different key.
withModules()  : PageIndex
withPages()  : PageIndex
withPublished()  : FlexPageIndex
withRoutable()  : FlexPageIndex
withTranslated()  : static
withTranslation()  : PageIndex
withVisible()  : FlexPageIndex
createFrom()  : static
Creates a new instance from the specified elements.
filterByParent()  : static
getActiveUser()  : UserInterface|null
getAuthorizeScope()  : string
getContainer()  : Grav
getCurrentKey()  : string
getElementMeta()  : mixed
getEntries()  : array<string|int, mixed>
getFallbackLanguages()  : array<string|int, mixed>
getFlexContainer()  : Flex
getIndexFile()  : CompiledJsonFile|CompiledYamlFile|null
getIndexKeys()  : array<string|int, mixed>
getLanguageTemplates()  : array<string|int, mixed>
getLevelListingRecurse()  : array<string|int, mixed>
getListingActions()  : array<string|int, mixed>
getTypePrefix()  : string
getUnserializeAllowedClasses()  : array<string|int, mixed>|bool
isAdminSite()  : bool
isAllowedElement()  : bool
loadCollection()  : CollectionInterface
loadElement()  : ObjectInterface|null
loadElements()  : array<string|int, ObjectInterface>
loadEntriesFromIndex()  : array<string|int, mixed>
loadIndex()  : array<string|int, mixed>
onChanges()  : void
onException()  : void
setEntries()  : void
setIndexKeys()  : void
setKeyField()  : void
translateEntries()  : array<string|int, mixed>
updateIndexData()  : void
updateIndexFile()  : array<string|int, mixed>
jsDate()  : string|null

Constants

ORDER_LIST_REGEX

public mixed ORDER_LIST_REGEX = '/(\/\d+)\.[^\/]+/u'

ORDER_PREFIX_REGEX

public mixed ORDER_PREFIX_REGEX = '/^\d+\./u'

PAGE_ROUTE_REGEX

public mixed PAGE_ROUTE_REGEX = '/\/\d+\./u'

VERSION

public mixed VERSION = parent::VERSION . '.5'

Properties

$_params

protected array<string|int, mixed>|null $_params

Methods

__call()

public __call(string $name, array<string|int, mixed> $arguments) : mixed
Parameters
$name : string
$arguments : array<string|int, mixed>
Attributes
#[ReturnTypeWillChange]

__construct()

Initializes a new FlexIndex.

public __construct([array<string|int, mixed> $entries = [] ][, FlexDirectory|null $directory = null ]) : mixed
Parameters
$entries : array<string|int, mixed> = []
$directory : FlexDirectory|null = null

__debugInfo()

public __debugInfo() : array<string|int, mixed>
Attributes
#[ReturnTypeWillChange]
Return values
array<string|int, mixed>

__serialize()

public __serialize() : array<string|int, mixed>
Return values
array<string|int, mixed>

__toString()

Returns a string representation of this object.

public __toString() : string
Attributes
#[ReturnTypeWillChange]
Return values
string

__unserialize()

public __unserialize(array<string|int, mixed> $data) : void
Parameters
$data : array<string|int, mixed>

adjacentSibling()

Returns the adjacent sibling based on a direction.

public adjacentSibling(string $path[, int $direction = 1 ]) : PageObject|false
Parameters
$path : string
$direction : int = 1

either -1 or +1

Tags
phpstan-return

T|false

Return values
PageObject|false

The sibling item.

all()

Mimicks Pages class.

public all() : $this

Not needed anymore in Flex Pages (does nothing).

Return values
$this

batch()

Split collection into array of smaller collections.

public batch(int $size) : array<string|int, PageCollection>
Parameters
$size : int
Tags
phpstan-return

C[]

Return values
array<string|int, PageCollection>

call()

public call(mixed $method[, array<string|int, mixed> $arguments = [] ]) : array<string|int, mixed>|mixed
Parameters
$method : mixed
$arguments : array<string|int, mixed> = []
Return values
array<string|int, mixed>|mixed

chunk()

Split collection into chunks.

public chunk(int $size) : array<string|int, mixed>
Parameters
$size : int

Size of each chunk.

Tags
phpstan-return

array<array<TKey,T>>

Return values
array<string|int, mixed>

collectionGroup()

Group items in the collection by a field and return them as associated array of collections.

public collectionGroup(string $property) : array<string|int, ObjectCollectionInterface>
Parameters
$property : string
Tags
phpstan-return

C[]

Return values
array<string|int, ObjectCollectionInterface>

copy()

Create a copy of this collection

public copy() : static
Tags
phpstan-return

static<T,C>

Return values
static

createFromArray()

Creates a Flex Collection from an array.

public static createFromArray(array<string|int, mixed> $entries, FlexDirectory $directory[, string $keyField = null ]) : static
Parameters
$entries : array<string|int, mixed>

Associated array of Flex Objects to be included in the collection.

$directory : FlexDirectory

Flex Directory where all the objects belong into.

$keyField : string = null

Key field used to index the collection.

Tags
see
FlexCollectionInterface::createFromArray()
Return values
static

Returns a new Flex Collection.

createFromStorage()

Helper method to create Flex Index.

public static createFromStorage(FlexDirectory $directory) : static
Parameters
$directory : FlexDirectory
Tags
phpstan-return

static<T,C>

Return values
static

currentPosition()

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 ]) : static
Parameters
$startDate : string|null = null
$endDate : string|null = null
$field : string|null = null
Tags
phpstan-return

static<T,C>

throws
Exception
Return values
static

defNestedProperty()

public defNestedProperty(string $property, mixed $default[, string|null $separator = null ]) : ObjectCollectionInterface
Parameters
$property : string

Object property to be defined.

$default : mixed

Default value.

$separator : string|null = null

Separator, defaults to '.'

Tags
phpstan-return

C

Return values
ObjectCollectionInterface

filterBy()

Filter pages by given filters.

public filterBy(array<string|int, mixed> $filters[, bool $recursive = false ]) : static
  • search: string
  • page_type: string|string[]
  • modular: bool
  • visible: bool
  • routable: bool
  • published: bool
  • page: bool
  • translated: bool
Parameters
$filters : array<string|int, mixed>
$recursive : bool = false
Tags
phpstan-return

static<T,C>

Return values
static

get()

{@inheritDoc}

public get(string $key) : PageObject|null
Parameters
$key : string
Tags
phpstan-return

T|null

Return values
PageObject|null

getCacheChecksum()

Get cache checksum for the object / collection.

public getCacheChecksum() : string
Tags
see
FlexCollectionInterface::getCacheChecksum()
Return values
string

Returns cache checksum.

getCacheKey()

Get a cache key which is used for caching the object / collection.

public getCacheKey() : string
Tags
see
FlexCollectionInterface::getCacheKey()
Return values
string

Returns cache key.

getFlexDirectory()

Get Flex Directory for the object / collection.

public getFlexDirectory() : FlexDirectory
Tags
see
FlexCollectionInterface::getFlexDirectory()
Return values
FlexDirectory

Returns associated Flex Directory.

getFlexFeatures()

Get full list of features the object / collection implements.

public getFlexFeatures() : array<string|int, mixed>
Tags
see
FlexCommonInterface::hasFlexFeature()
Return values
array<string|int, mixed>

getFlexKeys()

Get Flex keys from all the objects in the collection.

public getFlexKeys() : array<string|int, string>
Tags
see
FlexCollectionInterface::getFlexKeys()
Return values
array<string|int, string>

Returns[key => flex_key, ...] pairs.

getFlexType()

Get Flex Type of the object / collection.

public getFlexType() : string
Tags
see
FlexCollectionInterface::getFlexType()
Return values
string

Returns Flex Type of the collection.

getIndexMap()

public getIndexMap([string $indexKey = null ]) : array<string|int, mixed>
Parameters
$indexKey : string = null
Tags
see
FlexIndexInterface::getFlexKeys()
Return values
array<string|int, mixed>

getIterator()

Required by interface IteratorAggregate.

public getIterator() : mixed
Tags
phpstan-return

Iterator<TKey,T>

Attributes
#[ReturnTypeWillChange]

getKey()

public getKey() : string
Return values
string

getKeyField()

public getKeyField() : string
Return values
string

getLanguage()

public getLanguage() : string|null
Return values
string|null

getLevelListing()

public getLevelListing(array<string|int, mixed> $options) : array<string|int, mixed>
Parameters
$options : array<string|int, mixed>
Return values
array<string|int, mixed>

getMetaData()

Get metadata associated to the object

public getMetaData(string $key) : array<string|int, mixed>
Parameters
$key : string
Return values
array<string|int, mixed>

getNestedProperty()

public getNestedProperty(string $property[, mixed $default = null ][, string|null $separator = null ]) : array<string|int, mixed>
Parameters
$property : string

Object property to be fetched.

$default : mixed = null

Default value if property has not been set.

$separator : string|null = null

Separator, defaults to '.'

Return values
array<string|int, mixed>

Property values.

getObjectKeys()

public getObjectKeys() : array<string|int, mixed>
Return values
array<string|int, mixed>

getParam()

Get the collection param

public getParam(string $name) : mixed
Parameters
$name : string

getParams()

Get the collection params

public getParams() : array<string|int, mixed>
Return values
array<string|int, mixed>

getProperty()

public getProperty(string $property[, mixed $default = null ]) : array<string|int, mixed>
Parameters
$property : string

Object property to be fetched.

$default : mixed = null

Default value if property has not been set.

Return values
array<string|int, mixed>

Property values.

getStorageKeys()

Get storage keys from all the objects in the collection.

public getStorageKeys() : array<string|int, string>
Tags
see
FlexCollectionInterface::getStorageKeys()
Return values
array<string|int, string>

Returns [key => storage_key, ...] pairs.

getTimestamp()

Get last updated timestamp for the object / collection.

public getTimestamp() : int
Tags
see
FlexCollectionInterface::getTimestamp()
Return values
int

Returns Unix timestamp.

getTimestamps()

Get timestamps from all the objects in the collection.

public getTimestamps() : array<string|int, int>
Tags
see
FlexCollectionInterface::getTimestamps()
Return values
array<string|int, int>

Returns [key => timestamp, ...] pairs.

getType()

public getType([bool $prefix = false ]) : string

Use ->getFlexType() instead.

Parameters
$prefix : bool = false
Return values
string

group()

Group items in the collection by a field and return them as associated array.

public group(string $property) : array<string|int, mixed>
Parameters
$property : string
Return values
array<string|int, mixed>

hasFlexFeature()

Test whether the feature is implemented in the object / collection.

public hasFlexFeature(string $name) : bool
Parameters
$name : string
Tags
see
FlexCommonInterface::hasFlexFeature()
Return values
bool

hasNestedProperty()

public hasNestedProperty(string $property[, string|null $separator = null ]) : array<string|int, bool>
Parameters
$property : string

Object property name.

$separator : string|null = null

Separator, defaults to '.'

Return values
array<string|int, bool>

True if property has been defined (can be null).

hasProperty()

public hasProperty(string $property) : array<string|int, bool>
Parameters
$property : string

Object property name.

Return values
array<string|int, bool>

True if property has been defined (can be null).

isFirst()

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.

jsonSerialize()

Implements JsonSerializable interface.

public jsonSerialize() : array<string|int, mixed>
Attributes
#[ReturnTypeWillChange]
Return values
array<string|int, mixed>

limit()

public limit(int $start[, int|null $limit = null ]) : static
Parameters
$start : int
$limit : int|null = null
Tags
phpstan-return

static<TKey,T,C>

Return values
static

loadEntriesFromStorage()

Method to load index from the object storage, usually filesystem.

public static loadEntriesFromStorage(FlexStorageInterface $storage) : array<string|int, mixed>
Parameters
$storage : FlexStorageInterface
Return values
array<string|int, mixed>

modular()

Creates new collection with only modular pages

public modular() : static
Tags
phpstan-return

static<T,C>

Return values
static

The collection with only modular pages

modules()

Creates new collection with only modular pages

public modules() : static
Tags
phpstan-return

static<T,C>

Return values
static

The collection with only modular pages

nextSibling()

Gets the next sibling based on current position.

public nextSibling(string $path) : PageObject|null
Parameters
$path : string
Tags
phpstan-return

T|null

Return values
PageObject|null

The next item.

nonModular()

Creates new collection with only non-modular pages

public nonModular() : static
Tags
phpstan-return

static<T,C>

Return values
static

The collection with only non-modular pages

nonPublished()

Creates new collection with only non-published pages

public nonPublished() : static
Tags
phpstan-return

static<T,C>

Return values
static

The collection with only non-published pages

nonRoutable()

Creates new collection with only non-routable pages

public nonRoutable() : static
Tags
phpstan-return

static<T,C>

Return values
static

The collection with only non-routable pages

nonVisible()

Creates new collection with only non-visible pages

public nonVisible() : static
Tags
phpstan-return

static<T,C>

Return values
static

The collection with only non-visible pages

offsetExists()

Required by interface ArrayAccess.

public offsetExists(string|int|null $offset) : bool
Parameters
$offset : string|int|null
Tags
phpstan-param

TKey|null $offset

Attributes
#[ReturnTypeWillChange]
Return values
bool

offsetGet()

Required by interface ArrayAccess.

public offsetGet(string|int|null $offset) : mixed
Parameters
$offset : string|int|null
Tags
phpstan-param

TKey|null $offset

Attributes
#[ReturnTypeWillChange]

offsetSet()

Required by interface ArrayAccess.

public offsetSet(string|int|null $offset, mixed $value) : void
Parameters
$offset : string|int|null
$value : mixed
Tags
phpstan-param

TKey|null $offset

Attributes
#[ReturnTypeWillChange]

offsetUnset()

Required by interface ArrayAccess.

public offsetUnset(string|int|null $offset) : void
Parameters
$offset : string|int|null
Tags
phpstan-param

TKey|null $offset

Attributes
#[ReturnTypeWillChange]

ofOneOfTheseAccessLevels()

Creates new collection with only pages of one of the specified access levels

public ofOneOfTheseAccessLevels(array<string|int, mixed> $accessLevels) : static
Parameters
$accessLevels : array<string|int, mixed>
Tags
phpstan-return

static<T,C>

Return values
static

The collection

ofOneOfTheseTypes()

Creates new collection with only pages of one of the specified types

public ofOneOfTheseTypes(array<string|int, string> $types) : static
Parameters
$types : array<string|int, string>
Tags
phpstan-return

static<T,C>

Return values
static

The collection

ofType()

Creates new collection with only pages of the specified type

public ofType(string $type) : static
Parameters
$type : string
Tags
phpstan-return

static<T,C>

Return values
static

The collection

order()

Reorder collection.

public order(string $by[, string $dir = 'asc' ][, array<string|int, mixed> $manual = null ][, string $sort_flags = null ]) : static
Parameters
$by : string
$dir : string = 'asc'
$manual : array<string|int, mixed> = null
$sort_flags : string = null
Tags
phpstan-return

static<T,C>

Return values
static

orderBy()

public orderBy(array<string|int, mixed> $orderings) : static
Parameters
$orderings : array<string|int, mixed>
Tags
phpstan-return

static<T,C>

Return values
static

pages()

Creates new collection with only non-modular pages

public pages() : static
Tags
phpstan-return

static<T,C>

Return values
static

The collection with only non-modular 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) : PageObject|null
Parameters
$path : string
Tags
phpstan-return

T|null

Return values
PageObject|null

The previous item.

published()

Creates new collection with only published pages

public published() : static
Tags
phpstan-return

static<T,C>

Return values
static

The collection with only published pages

remove()

Remove item from the list.

public remove(string $key) : PageObject|null
Parameters
$key : string
Tags
phpstan-return

T|null

throws
InvalidArgumentException
Return values
PageObject|null

removeElement()

{@inheritDoc}

public removeElement(mixed $element) : mixed
Parameters
$element : mixed

render()

Renders the object.

public render([string $layout = null ][, array<string|int, mixed> $context = [] ]) : ContentBlockInterface|HtmlBlock
Parameters
$layout : string = null

Layout to be used.

$context : array<string|int, mixed> = []

Extra context given to the renderer.

Tags
see
FlexCollectionInterface::render()
Return values
ContentBlockInterface|HtmlBlock

Returns HtmlBlock containing the rendered output.

reverse()

Reverse the order of the items.

public reverse() : static
Tags
phpstan-return

static<TKey,T,C>

Return values
static

routable()

Creates new collection with only routable pages

public routable() : static
Tags
phpstan-return

static<T,C>

Return values
static

The collection with only routable pages

Search a string from the collection.

public search(string $search[, mixed $properties = null ][, array<string|int, mixed> $options = null ]) : FlexCollectionInterface
Parameters
$search : string

Search string.

$properties : mixed = null

Properties to search for, defaults to configured properties.

$options : array<string|int, mixed> = null

Search options, defaults to configured options.

Tags
see
FlexCollectionInterface::search()
Return values
FlexCollectionInterface

Returns a Flex Collection with only matching objects.

select()

Select items from collection.

public select(array<string|int, mixed> $keys) : static

Collection is returned in the order of $keys given to the function.

Parameters
$keys : array<string|int, mixed>
Tags
phpstan-return

static<TKey,T,C>

Return values
static

serialize()

public final serialize() : string
Return values
string

set()

{@inheritDoc}

public set(mixed $key, mixed $value) : mixed
Parameters
$key : mixed
$value : mixed

setKey()

public setKey(string $key) : $this
Parameters
$key : string
Return values
$this

setNestedProperty()

public setNestedProperty(string $property, mixed $value[, string|null $separator = null ]) : ObjectCollectionInterface
Parameters
$property : string

Object property to be updated.

$value : mixed

New value.

$separator : string|null = null

Separator, defaults to '.'

Tags
phpstan-return

C

Return values
ObjectCollectionInterface

setParam()

Set a parameter to the Collection

public setParam(string $name, mixed $value) : $this
Parameters
$name : string
$value : mixed
Return values
$this

setParams()

Set parameters to the Collection

public setParams(array<string|int, mixed> $params) : $this
Parameters
$params : array<string|int, mixed>
Return values
$this

shuffle()

Shuffle items.

public shuffle() : static
Tags
phpstan-return

static<TKey,T,C>

Return values
static

slice()

{@inheritDoc}

public slice(mixed $offset[, mixed $length = null ]) : mixed
Parameters
$offset : mixed
$length : mixed = null

toArray()

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
throws
Exception
Return values
array<string|int, mixed>

unselect()

Un-select items from collection.

public unselect(array<string|int, mixed> $keys) : static
Parameters
$keys : array<string|int, mixed>
Tags
phpstan-return

static<TKey,T,C>

Return values
static

unserialize()

public final unserialize(string $serialized) : void
Parameters
$serialized : string

unsetNestedProperty()

public unsetNestedProperty(string $property[, string|null $separator = null ]) : ObjectCollectionInterface
Parameters
$property : string

Object property to be unset.

$separator : string|null = null

Separator, defaults to '.'

Tags
phpstan-return

C

Return values
ObjectCollectionInterface

updateObjectMeta()

You can define indexes for fast lookup.

public static updateObjectMeta(array<string|int, mixed> &$meta, array<string|int, mixed> $data, FlexStorageInterface $storage) : void

Primary key: $meta['key'] Secondary keys: $meta['my_field']

Parameters
$meta : array<string|int, mixed>
$data : array<string|int, mixed>
$storage : FlexStorageInterface

visible()

Creates new collection with only visible pages

public visible() : static
Tags
phpstan-return

static<T,C>

Return values
static

The collection with only visible pages

withKeyField()

Return new collection with a different key.

public withKeyField([string $keyField = null ]) : static
Parameters
$keyField : string = null

Switch key field of the collection.

Tags
see
FlexIndexInterface::withKeyField()
Return values
static

Returns a new Flex Collection with new key field.

withTranslated()

public withTranslated([string|null $languageCode = null ][, bool|null $fallback = null ]) : static
Parameters
$languageCode : string|null = null
$fallback : bool|null = null
Tags
phpstan-return

static<T,C>

Return values
static

withTranslation()

public withTranslation([bool $bool = = 'true' ][, string $languageCode = = 'null' ][, bool $fallback = = 'null' ]) : PageIndex
Parameters
$bool : bool = = 'true'
$languageCode : string = = 'null'
$fallback : bool = = 'null'
Return values
PageIndex

createFrom()

Creates a new instance from the specified elements.

protected createFrom(array<string|int, mixed> $entries[, string|null $keyField = null ]) : static
Parameters
$entries : array<string|int, mixed>
$keyField : string|null = null
Tags
phpstan-return

static<T,C>

Return values
static

filterByParent()

protected filterByParent(array<string|int, mixed> $filters) : static
Parameters
$filters : array<string|int, mixed>
Tags
phpstan-return

static<T,C>

Return values
static

getAuthorizeScope()

protected getAuthorizeScope() : string
Return values
string

getEntries()

protected getEntries() : array<string|int, mixed>
Return values
array<string|int, mixed>

getFallbackLanguages()

protected getFallbackLanguages([string|null $languageCode = null ][, bool|null $fallback = null ]) : array<string|int, mixed>
Parameters
$languageCode : string|null = null
$fallback : bool|null = null
Return values
array<string|int, mixed>

getIndexKeys()

protected getIndexKeys() : array<string|int, mixed>
Return values
array<string|int, mixed>

getLanguageTemplates()

protected getLanguageTemplates(string $key) : array<string|int, mixed>
Parameters
$key : string
Return values
array<string|int, mixed>

getLevelListingRecurse()

protected getLevelListingRecurse(array<string|int, mixed> $options) : array<string|int, mixed>
Parameters
$options : array<string|int, mixed>
Return values
array<string|int, mixed>

getTypePrefix()

protected getTypePrefix() : string
Return values
string

getUnserializeAllowedClasses()

protected getUnserializeAllowedClasses() : array<string|int, mixed>|bool
Return values
array<string|int, mixed>|bool

isAdminSite()

protected isAdminSite() : bool
Return values
bool

isAllowedElement()

protected isAllowedElement(mixed $value) : bool
Parameters
$value : mixed
Return values
bool

loadElements()

protected loadElements([array<string|int, mixed>|null $entries = null ]) : array<string|int, ObjectInterface>
Parameters
$entries : array<string|int, mixed>|null = null
Tags
phpstan-return

T[]

Return values
array<string|int, ObjectInterface>

onChanges()

protected static onChanges(array<string|int, mixed> $entries, array<string|int, mixed> $added, array<string|int, mixed> $updated, array<string|int, mixed> $removed) : void
Parameters
$entries : array<string|int, mixed>
$added : array<string|int, mixed>
$updated : array<string|int, mixed>
$removed : array<string|int, mixed>

onException()

protected static onException(Exception $e) : void
Parameters
$e : Exception

setEntries()

protected setEntries(array<string|int, mixed> $entries) : void
Parameters
$entries : array<string|int, mixed>
Tags
phpstan-param

array<TKey,T> $entries

setIndexKeys()

protected setIndexKeys(array<string|int, mixed> $indexKeys) : void
Parameters
$indexKeys : array<string|int, mixed>

setKeyField()

protected setKeyField([string|null $keyField = null ]) : void
Parameters
$keyField : string|null = null

translateEntries()

protected translateEntries(array<string|int, mixed> $entries, string $lang[, bool|null $fallback = null ]) : array<string|int, mixed>
Parameters
$entries : array<string|int, mixed>
$lang : string
$fallback : bool|null = null
Return values
array<string|int, mixed>

updateIndexData()

protected static updateIndexData(array<string|int, mixed> &$entry, array<string|int, mixed> $data) : void

Use static ::updateObjectMeta() method instead.

Parameters
$entry : array<string|int, mixed>
$data : array<string|int, mixed>

updateIndexFile()

protected static updateIndexFile(FlexStorageInterface $storage, array<string|int, mixed> $index, array<string|int, mixed> $entries[, array<string|int, mixed> $options = [] ]) : array<string|int, mixed>
Parameters
$storage : FlexStorageInterface
$index : array<string|int, mixed>

Saved index

$entries : array<string|int, mixed>

Updated index

$options : array<string|int, mixed> = []
Return values
array<string|int, mixed>

Compiled list of entries

jsDate()

private jsDate([int|null $timestamp = null ]) : string|null
Parameters
$timestamp : int|null = null
Return values
string|null

        
On this page

Search results