Is there any page that matches the given $selector in the system? (with no exclusions)
- This can be used as an “exists” or “getID” type of method.
- Returns ID of first matching page if any exist, or 0 if none exist (returns array if
$verbose
is true). - Like with the
get()
method, no pages are excluded, so aninclude=all
is not necessary in selector. - If you need to quickly check if something exists, this method is preferable to using a count() or get().
When $verbose
option is used, an array is returned instead. Verbose return array includes all columns
from the matching row in the pages table.
Available since version 3.0.153.
Usage
// basic usage
$array = $pagesLoader->has($selector);
// usage with all arguments
$array = $pagesLoader->has($selector, bool $verbose = false, array $options = []);
Arguments
Name | Type(s) | Description |
---|---|---|
selector | string, int, array, Selectors | |
verbose (optional) | bool | Return verbose array with all pages columns rather than just page id? (default=false) |
options (optional) | array | Additional options to pass in find() $options argument (not currently applicable) |
Return value
array
int
PagesLoader methods and properties
API reference based on ProcessWire core version 3.0.236