Torsten Baldes Posted September 24, 2014 Share Posted September 24, 2014 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! Link to comment Share on other sites More sharing options...
MadeMyDay Posted September 24, 2014 Share Posted September 24, 2014 Why not use a page field and select the origin entry? Link to comment Share on other sites More sharing options...
Torsten Baldes Posted September 24, 2014 Author Share Posted September 24, 2014 for multiple (ok, two) reasons: I want to modify some contents not only display a copy I have hundreds of PageTable pages, some with auto generated titles and selecting the right one would be a pain in the a… Link to comment Share on other sites More sharing options...
MadeMyDay Posted September 24, 2014 Share Posted September 24, 2014 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 More sharing options...
Torsten Baldes Posted September 24, 2014 Author Share Posted September 24, 2014 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. Link to comment Share on other sites More sharing options...
LostKobrakai Posted September 24, 2014 Share Posted September 24, 2014 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(); 1 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now