Jump to content

Recommended Posts

Posted

hi there,

is it somehow possible to copy/duplicate one PageTable entry from one page to another page?

I have some similar entries on, which i also want to use/insert and modify on other pages, without adding all the content again and again.

Thanks!

Posted

for multiple (ok, two) reasons:  :-[

  1. I want to modify some contents not only display a copy
  2. I have hundreds of PageTable pages, some with auto generated titles and selecting the right one would be a pain in the a…
Posted

Now I understood. You don't want permanent clones, you just want something like an already filled entry. So what you basically want is the ability to clone an existing pagetable entry from a preset. Perhaps take a look at the ProcessPageClone how cloning is done there. But that is beyond my skills to adapt somehting like that to pagetable entries :( Could be done with a module, which prefills values under certain circumstances on Inputfield::render but... phew.

Posted

yeah, think of similar products with almost the same information, but some differences.

basically it's cloning and inserting of a page. but technically i have no idea, how i could implement such function.

Posted

PageTables are handled the same as other pagefields. So you can just use something like this:

$selected_page = $pages->get("something"); // Get the Page
$selected_table_entry = $selected_page->table->eq(0); // Get the PageTable entry
$clone = $pages->clone($selected_table_entry); // Clone the entry

$new_page = $pages->get("something"); // Get the page to copy to
$new_page->table->add($clone); // Add the clone to the PageTable
$new_page->save();
  • Thanks 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...