PagesRaw::find() method

Find pages and return raw data from them in a PHP array

Available since version 3.0.172.

Usage

// basic usage
$array = $pagesRaw->find($selector);

// usage with all arguments
$array = $pagesRaw->find($selector, $field = '', array $options = []);

Arguments

NameType(s)Description
selectorstring, array, Selectors
field (optional)string, array, Field

Name of field/property to get, or array of them, CSV string, or omit to get all (default='')

  • Optionally use associative array to rename fields in returned value, i.e. ['title' => 'label'] returns 'title' as 'label' in return value.
  • Specify parent.field_name or parent.parent.field_name, etc. to return values from parent(s). 3.0.193+
  • Specify references or references.field_name, etc. to also return values from pages referencing found pages. 3.0.193+
  • Specify meta or meta.name to also return values from page meta data. 3.0.193+
options (optional)array

See options for Pages::find

  • objects (bool): Use objects rather than associative arrays? (default=false)
  • entities (bool|array): Entity encode string values? True, or specify array of field names. (default=false)
  • nulls (bool): Populate nulls for field values that are not present, rather than omitting them? (default=false) 3.0.198+
  • indexed (bool): Index by page ID? (default=true)
  • flat (bool|string): Flatten return value as ["field.subfield" => "value"] rather than ["field" => ["subfield" => "value"]]? Optionally specify field delimiter, otherwise a period . will be used as the delimiter. (default=false) 3.0.193+
  • Note the objects and flat options are not meant to be used together.

Return value

array


PagesRaw methods and properties

API reference based on ProcessWire core version 3.0.236

Latest news

  • ProcessWire Weekly #549
    In the 549th issue of ProcessWire Weekly we’re going to check out the latest core updates, highlight one older yet still very relevant third party module, and more. Read on!
    Weekly.pw / 17 November 2024
  • Custom Fields Module
    This week we look at a new ProFields module named Custom Fields. This module provides a way to rapidly build out ProcessWire fields that contain any number of subfields/properties within them.
    Blog / 30 August 2024
  • Subscribe to weekly ProcessWire news

“The end client and designer love the ease at which they can update the website. Training beyond how to log in wasn’t even necessary since ProcessWire’s default interface is straightforward.” —Jonathan Lahijani