Available since version 3.0.156. Previous versions can use $pages->getById() for similar behavior
Usage
// basic usage
$items = $pages->getByIDs($ids);
// usage with all arguments
$items = $pages->getByIDs($ids, array $options = []);
Arguments
Name | Type(s) | Description |
---|
$ids | array string WireArray | Any one of the following: - Single page ID (string or int)
- Array of page IDs
- Comma or pipe-separated string of page IDs
- Array of associative arrays having id and templates_id: [ [ 'id' => 1, 'templates_id' => 2], [ 'id' => 3, 'templates_id' => 4 ] ]
|
$options (optional) | array | Options to affect behavior. The 'template' option is recommended when you have this info available. template (Template|int|string): Template object, name or ID to use for loaded pages. Default:nullparent (Page|int|string): Parent Page object, ID, or path to use for loaded pages. Default:nullcache (bool): Place loaded pages in memory cache? Default:truegetFromCache (bool): Allow use of previously cached pages in memory (rather than re-loading it from DB)? Default:truegetNumChildren (bool): Specify false to disable retrieval and population of 'numChildren' Page property. Default:truegetOne (bool): Specify true to return just one Page object, rather than a PageArray. Default:falseautojoin (bool): Allow use of autojoin option? Default:truejoinFields (array): Autojoin the field names specified in this array, regardless of field settings (requires autojoin=true). Default:emptyjoinSortfield (bool): Whether the 'sortfield' property will be joined to the page. Default:truefindTemplates (bool): Determine which templates will be used (when no template specified) for more specific autojoins. Default:truepageClass (string): Class to instantiate Page objects with. Leave blank to determine from template. Default:auto-detectpageArrayClass (string): PageArray-derived class to store pages in (when 'getOne' is false). Default:PageArraypageArray (PageArray|null): Populate this existing PageArray rather than creating a new one. Default:nullpage (Page|null): Existing Page object to populate (also requires the getOne option to be true). Default:null
|
Return value
PageArray
Page
Returns PageArray unless the getOne option was specified in which case a Page is returned.
$pages methods and properties
API reference based on ProcessWire core version 3.0.251