Overview

Namespaces

  • None
  • PHP

Classes

  • Breadcrumb
  • Breadcrumbs
  • CacheFile
  • Comment
  • CommentArray
  • CommentFilter
  • CommentForm
  • CommentList
  • Config
  • Database
  • DatabaseQuery
  • DatabaseQuerySelect
  • DatabaseQuerySelectFulltext
  • DatabaseStopwords
  • Debug
  • Field
  • Fieldgroup
  • Fieldgroups
  • FieldgroupsArray
  • Fields
  • FieldsArray
  • Fieldtype
  • FieldtypeMulti
  • Fieldtypes
  • FileLog
  • FilenameArray
  • Fuel
  • HookEvent
  • ImageSizer
  • Inputfield
  • InputfieldsArray
  • InputfieldWrapper
  • Language
  • LanguageParser
  • Languages
  • LanguagesPageFieldValue
  • LanguageSupportInstall
  • LanguageTranslator
  • Markdown_Parser
  • MarkdownExtra_Parser
  • ModuleJS
  • ModulePlaceholder
  • Modules
  • Notice
  • NoticeError
  • NoticeMessage
  • Notices
  • NullPage
  • Page
  • PageArray
  • Pagefile
  • Pagefiles
  • PagefilesManager
  • PageFinder
  • Pageimage
  • Pageimages
  • PagerNav
  • PagerNavItem
  • Pages
  • PagesAccess
  • PagesSortfields
  • PagesType
  • Paths
  • Permission
  • Permissions
  • Process
  • ProcessController
  • ProcessWire
  • Role
  • Roles
  • Sanitizer
  • Selector
  • SelectorBitwiseAnd
  • SelectorContains
  • SelectorContainsLike
  • SelectorContainsWords
  • SelectorEnds
  • SelectorEqual
  • SelectorGreaterThan
  • SelectorGreaterThanEqual
  • SelectorLessThan
  • SelectorLessThanEqual
  • SelectorNotEqual
  • Selectors
  • SelectorStarts
  • Session
  • SessionCSRF
  • SmartyPants_Parser
  • SmartyPantsTypographer_Parser
  • SystemUpdate1
  • Template
  • TemplateFile
  • Templates
  • TemplatesArray
  • Textformatter
  • Textile
  • User
  • Users
  • Wire
  • WireArray
  • WireData
  • WireInput
  • WireInputData
  • WireSaveableItems
  • WireSaveableItemsLookup
  • WireUpload

Interfaces

  • CommentFormInterface
  • CommentListInterface
  • ConfigurableModule
  • FieldtypeLanguageInterface
  • FieldtypePageTitleCompatible
  • HasLookupItems
  • HasRoles
  • InputfieldHasArrayValue
  • Module
  • Saveable
  • TrackChanges

Exceptions

  • ProcessController404Exception
  • ProcessControllerPermissionException
  • Wire404Exception
  • WireDatabaseException
  • WireException
  • WirePermissionException

Functions

  • __
  • _n
  • _x
  • fuel
  • identify_modifier_markdown
  • Markdown
  • mdwp_add_p
  • mdwp_hide_tags
  • mdwp_show_tags
  • mdwp_strip_p
  • ProcessWireClassLoader
  • ProcessWireHostSiteConfig
  • ProcessWireShutdown
  • removeNewlines
  • SmartDashes
  • SmartEllipsis
  • SmartQuotes
  • smarty_modifier_markdown
  • smarty_modifier_smartypants
  • SmartyPants
  • tabIndent
  • unregisterGLOBALS
  • wire
  • wireDecodeJSON
  • wireEncodeJSON
  • wireMkdir
  • Overview
  • Namespace
  • Class
  • Tree
  • Download

Class PageArray

ProcessWire PageArray

PageArray provides an array-like means for storing PageReferences and is utilized throughout ProcessWire.

ProcessWire 2.x Copyright (C) 2010 by Ryan Cramer Licensed under GNU/GPL v2, see LICENSE.TXT

http://www.processwire.com http://www.ryancramer.com

Wire implements TrackChanges
Extended by WireArray implements IteratorAggregate, ArrayAccess, Countable
Extended by PageArray
Located at core/PageArray.php
Methods summary
public boolean
# isValidItem( mixed $item )

Template mehod that descendant classes may use to validate items added to this WireArray

Template mehod that descendant classes may use to validate items added to this WireArray

Parameters

$item
mixed
Item to add

Returns

boolean
True if item is valid and may be added, false if not
public boolean
# isValidKey( string|integer $key )

Validate the key used to add a Page

Validate the key used to add a Page

PageArrays are keyed by an incremental number that does NOT relate to the Page ID.

Parameters

$key
string|integer

Returns

boolean
True if key is valid and may be used, false if not
public mixed
# makeBlankItem( )

Per WireArray interface, return a blank Page

Per WireArray interface, return a blank Page

Returns

mixed
public PageArray
# import( array|PageArray|Page $pages )

Import the provided pages into this PageArray.

Import the provided pages into this PageArray.

Parameters

$pages
array|PageArray|Page
Pages to import.

Returns

PageArray
reference to current instance.
public boolean
# has( Page|id $key )

Does this PageArray contain the given index or Page?

Does this PageArray contain the given index or Page?

Parameters

$key
Page|id
$page Array index or Page object.

Returns

boolean
True if the index or Page exists here, false if not.
public PageArray
# add( Page|PageArray|integer $page )

Add a Page to this PageArray.

Add a Page to this PageArray.

Parameters

$page
Page|PageArray|integer
Page object, PageArray object, or Page ID. If Page, the Page will be added. If PageArray, it will do the same thing as the import() function: import all the pages. If Page ID, it will be loaded and added.

Returns

PageArray
reference to current instance.
public
# set( integer $key, Page $value )

Sets an index in the PageArray.

Sets an index in the PageArray.

Parameters

$key
integer
Key of item to set.
$value
Page
Value of item.
public WireArray
# prepend( Page $item )

Prepend a Page to the beginning of the PageArray.

Prepend a Page to the beginning of the PageArray.

Parameters

$item
Page

Returns

WireArray
This instance.
public boolean
# remove( integer|Page $key )

Remove the given Page or key from the PageArray.

Remove the given Page or key from the PageArray.

Parameters

$key
integer|Page

Returns

boolean
true if removed, false if not
public Page|null
# shift( )

Shift the first Page off of the PageArray and return it.

Shift the first Page off of the PageArray and return it.

Returns

Page|null
public Page|null
# pop( )

Pop the last page off of the PageArray and return it.

Pop the last page off of the PageArray and return it.

Returns

Page|null
public PageArray
# setTotal( integer $total )

Set the total number of pages, if more than are in this PageArray.

Set the total number of pages, if more than are in this PageArray.

Used for pagination.

Parameters

$total
integer

Returns

PageArray
reference to current instance.
public integer
# getTotal( )

Get the total number of pages, if more than are in this PageArray.

Get the total number of pages, if more than are in this PageArray.

Used for pagination.

Returns

integer
public integer
# getLimit( )

Get the imposed limit on number of pages.

Get the imposed limit on number of pages.

If no limit set, then return number of pages currently in this PageArray.

Used for pagination.

Returns

integer
public
# setStart( integer $numStart )

Set the 'start' limitor that resulted in this PageArray

Set the 'start' limitor that resulted in this PageArray

Parameters

$numStart
integer
$numStart;
public integer
# getStart( )

If a limit was imposed, get the index of the starting result assuming other results preceded those present in this PageArray

If a limit was imposed, get the index of the starting result assuming other results preceded those present in this PageArray

Used for pagination.

Returns

integer
public PageArray
# setLimit( integer $numLimit )

Set the imposed limit that resulted in this PageArray.

Set the imposed limit that resulted in this PageArray.

Used for pagination.

Parameters

$numLimit
integer

Returns

PageArray
reference to current instance.
public
# setSelectors( Selectors $selectors )

Set the Selectors that led to this PageArray, if applicable

Set the Selectors that led to this PageArray, if applicable

Parameters

$selectors
Selectors
public Selectors|null
# getSelectors( )

Return the Selectors that led to this PageArray, or null if not set/applicable

Return the Selectors that led to this PageArray, or null if not set/applicable

Returns

Selectors|null
protected WireArray
# filterData( string|Selectors $selectors, boolean $not = false )

Filter out Pages that don't match the selector.

Filter out Pages that don't match the selector.

This is applicable to and destructive to the WireArray.

Parameters

$selectors
string|Selectors
AttributeSelector string to use as the filter.
$not
boolean
Make this a "not" filter? (default is false)

Returns

WireArray
reference to current [filtered] instance
public string
# __toString( )

PageArrays always return a string of the Page IDs separated by pipe "|" characters

PageArrays always return a string of the Page IDs separated by pipe "|" characters

Pipe charactesr are used for compatibility with Selector OR statements

Returns

string
Methods inherited from WireArray
__get(), __isset(), __set(), __unset(), _insert(), append(), count(), eq(), filter(), find(), findOne(), first(), get(), getAll(), getArray(), getItemKey(), getItemThatMatches(), getItemsAdded(), getItemsRemoved(), getIterator(), getKeys(), getNext(), getPrev(), getRandom(), getValues(), index(), insertAfter(), insertBefore(), iterable(), last(), makeNew(), not(), offsetExists(), offsetGet(), offsetSet(), offsetUnset(), push(), removeAll(), resetTrackChanges(), reverse(), setArray(), shuffle(), slice(), sort(), trackAdd(), trackRemove(), unique(), unshift(), usesNumericKeys()
Methods inherited from Wire
_(), ___changed(), __call(), _n(), _x(), addHook(), addHookAfter(), addHookBefore(), addHookProperty(), className(), error(), fuel(), getAllFuel(), getChanges(), getFuel(), getHooks(), isChanged(), isHooked(), message(), removeHook(), runHooks(), setFuel(), setTrackChanges(), trackChange(), trackChanges(), untrackChange(), useFuel()
Properties summary
protected integer $numTotal 0
#

Total number of pages, including those here and others that aren't, but may be here in pagination.

Total number of pages, including those here and others that aren't, but may be here in pagination.

protected integer $numLimit 0
#

If this PageArray is a partial representation of a larger set, this will contain the max number of pages allowed to be present/loaded in the PageArray at once.

If this PageArray is a partial representation of a larger set, this will contain the max number of pages allowed to be present/loaded in the PageArray at once.

May vary from count() when on the last page of a result set. As a result, paging routines should refer to their own itemsPerPage rather than count(). Applicable for paginated result sets. This number is not enforced for adding items to this PageArray.

protected integer $numStart 0
#

If this PageArray is a partial representation of a larger set, this will contain the starting result number if previous results preceded it.

If this PageArray is a partial representation of a larger set, this will contain the starting result number if previous results preceded it.

protected Selectors $selectors null
#

Reference to the selectors that led to this PageArray, if applicable

Reference to the selectors that led to this PageArray, if applicable

Properties inherited from WireArray
$data, $itemsAdded, $itemsRemoved
Properties inherited from Wire
$changes, $defaultHookOptions, $fuel, $hookMethodCache, $localHooks, $staticHooks, $trackChanges, $useFuel
ProcessWire API documentation generated by ApiGen 2.6.0