Get a unique page name
- If given no arguments, it returns a random globally unique page name.
- If given just a $name, it returns that name (if globally unique), or an incremented version of it that is globally unique.
- If given both $page and $name, it returns given name if unique in parent, or incremented version that is.
- If given just a $page, the name is pulled from $page and behavior is the same as #3 above.
The returned value is not yet assigned to the given $page, so if it is something different than what is already on $page, you’ll want to assign it manually after this.
Usage
// basic usage
$string = $pagesNames->uniquePageName();
// usage with all arguments
$string = $pagesNames->uniquePageName($name = '', $page = null, array $options = []);
Arguments
Name | Type(s) | Description |
---|---|---|
name (optional) | string, Page, array | Name to make unique You may optionally substitute the $page argument or $options arguments here, if that is all you need. |
page (optional) | ||
options (optional) | array |
|
Return value
string
Returns unique name
PagesNames methods and properties
API reference based on ProcessWire core version 3.0.236