Jump to content

PageTable: Copy entry from one Page to another


Torsten Baldes
 Share

Recommended Posts

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.

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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
 Share

×
×
  • Create New...