Duplicate a page in the panel in Kirby3

#1

Is it possible to duplicate a page in the panel? I guess i need a custom field with a button to achieve it. Is $page->hardcopy() the way to go?

0 Likes

#2

That would be better off in a custom section, not a field, as it is not supposed to store anything in the page.

And no, not hardcopy (that creates a clone), you have to create a page ($page->create()).

0 Likes

#3

Can i found some documentation about that, with some lines of code to get started please?

0 Likes

#4

https://getkirby.com/docs/reference/plugins/extensions/sections

0 Likes

#6

Is there a simple way to create a new page ($page->create()) with the content and structure of an existing page? What is the best way to do this?

1 Like

#7

Maybe as child of another page?

0 Likes

#8

If you want to duplicate a page from a section, it would probably be best to create a custom section with an option to copy a page from the drop down (where you currently select changeStatus etc.).

Another option you could test is @bnomei’s Janitor plugin with a custom job.

0 Likes

#9

I know how to make a custom section with a button, but I think i will have to look in php for some code to copy/paste a specific directory and content. Seems not possible in Kirby, or i don’t know how :slight_smile: Thanks anyway.

1 Like

#10

In the older versions of Kirby, duplicating a page was as easy as installing a plugin. Do none of these plugins work anymore? The methods above seem to be beyond my cap. Has anyone successfully implemented this function? If so, could you tell me how?

0 Likes

#11

Do you have an example of these Kirby 2 plugins?

0 Likes

#12

Yes:



1 Like