$page->duplicate()
Duplicates the page with the given slug and optionally copies all files
$page->duplicate(?string $slug = null, array $options = [ ]): Kirby\Cms\Page
Parameters
Name | Type | Default |
---|---|---|
$slug | string |null |
null |
$options | array |
[ ] |
Return type
Parent class
The $options
parameter
Name | Type |
---|---|
title |
string |
children |
bool |
files |
bool |
Example
$duplicate = $page->duplicate(
$page->slug() . '-copy',
[
'title' => 'New title',
'children' => true, // duplicate with children
'files' => true, // duplicate with files
],
);
Duplicates are always created as draft pages.