$page->changeStatus()
Change the status of the current page to either draft, listed or unlisted. If changing to listed
, you can pass a position for the page in the siblings collection. Siblings will be resorted.
$page->changeStatus(string $status, int|null $position = null): Kirby\Cms\Page
Parameters
Name | Type | Default | Description |
---|---|---|---|
$statusrequired | string |
no default value | "draft", "listed" or "unlisted" |
$position | int ornull |
null
|
Optional sorting number |
Return type
This method does not modify the existing $page
object but returns a new object with the changes applied. Learn more →
Exceptions
Type | Description |
---|---|
Kirby\Exception\InvalidArgumentException |
If an invalid status is being passed |
Parent class
Details
Note that you cannot change the status of a page using this method if you have set permissions that disallow changing the status, e.g. set status: false
in your blueprint.