PageArray class

PageArray is a paginated type of WireArray that holds multiple Page objects.

Please see the WireArray and PaginatedArray types for available methods, as they are not repeated here, except where PageArray has modified or extended those types in some manner. The PageArray type is functionally identical to WireArray and PaginatedArray except that it is focused specifically on managing Page objects.

PageArray is returned by all API methods in ProcessWire that can return more than one page at once. $pages->find() and $page->children() are common examples.

The recommended way to create a new PageArray is to use the $pages->newPageArray() method:

$pageArray = $pages->newPageArray();

Click any linked item for full usage details and examples. Hookable methods are indicated with the icon. In addition to those shown below, the PageArray class also inherits all the methods and properties of: PaginatedArray, WireArray and Wire.

Show class?             Show args?        

Common

NameReturnSummary 
PageArray::add($page)
$thisAdd one or more Page objects to this PageArray. 
PageArray::first Page null First item 
PageArray::getSelectors()
Selectors nullReturn the Selectors that led to this PageArray, or null if not set/applicable. 
PageArray::last Page null Last item 

Additional methods and properties

In addition to the methods and properties above, PageArray also inherits the methods and properties of these classes:

API reference based on ProcessWire core version 3.0.127

Twitter updates

  • New post: This week ProcessWire ProMailer has been released, plus we’ve got a nice upgrade in our community support forum, and more— More
    15 March 2019
  • New post: This week we look at the latest version of ProcessWire, 3.0.127 with nearly 30 new commits resolving dozens of older issue reports and a couple useful new features— More
    1 March 2019
  • New post: This week we take a look at what’s in ProcessWire 3.0.126 which focuses largely on resolving issue reports, but also includes a handy new Page if() method— More
    15 February 2019

Latest news

  • ProcessWire Weekly #253
    In the 253rd issue of ProcessWire Weekly we'll introduce the ProMailer Pro module, cover the upgrade made to our support forum software, check out Sanitizer Transliterate, and pick a new site of the week. Read on!
    Weekly.pw / 16 March 2019
  • ProcessWire ProMailer now available
    This week ProcessWire ProMailer has been released, plus we’ve got a nice upgrade in our community support forum, and more.
    Blog / 15 March 2019
  • Subscribe to weekly ProcessWire news

“ProcessWire is like a breath of fresh air. So powerful yet simple to build with and customise, and web editors love it too.” —Margaret Chatwin, Web developer