alexcapes Posted June 21, 2015 Share Posted June 21, 2015 Hi, I've created a module to copy across field content from one page to another page, which is working well for all fieldtypes, except for repeater fields. This is my current code for repeater fields: // Repeater if(count($page->article_list)) { $translation->of(false); $translation->article_list->removeAll(); foreach($page->article_list as $item) { $translation->article_list->import($item); } $translation->save(); } It copies across the repeaters and the fields within them fine (there are two fields, a textarea and image field). However only the content of the the textarea field is copied - the image field remains blank. (Just for reference it is a single image field). Can anyone help me out in how I might copy the image (and the description) across please? Thanks! Link to comment Share on other sites More sharing options...
alexcapes Posted June 22, 2015 Author Share Posted June 22, 2015 Not quite sure why but this is now working and copy across all field content (including images)... // Repeater if(count($page->article_list)) { $translation->of(false); $translation->article_list->removeAll(); $lists = $page->article_list; foreach($lists as $item) { $translation->article_list->import($item); $translation->save("article_list"); } } 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