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 #552
    In the 552nd issue of ProcessWire Weekly we'll check out the latest weekly update from Ryan, take a quick look at a new e-commerce solution for ProcessWire, and more. Read on!
    Weekly.pw / 7 December 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

“…building with ProcessWire was a breeze, I really love all the flexibility the system provides. I can’t imagine using any other CMS in the future.” —Thomas Aull