Juergen Posted September 27, 2017 Share Posted September 27, 2017 Hello @ all, I am trying to copy the values of the new fieldset (Page) type fields via API to a child page. Its a kind of repeater so I have tried to copy it like this: $k->eventdatesfieldset->import((wire('pages')->get($page->id))->eventdatesfieldset); "eventdatesfieldset" is the name of the fieldset. I have tried it with the import function like in repeaters but I always get the message "Method FieldsetPage::import does not exist or is not callable in this context". Does anyone has tried to copy fields from this new fieldtype and has a working solution? I want to copy the values to the child page. Best regards Link to comment Share on other sites More sharing options...
bernhard Posted September 27, 2017 Share Posted September 27, 2017 did you take a look at adrians adminactions module? i think there is a copy repeater contents action and i guess you can adopt it to your needs. 1 Link to comment Share on other sites More sharing options...
abdus Posted September 27, 2017 Share Posted September 27, 2017 I dont think it works like that. Being a repeater, FieldtypeFieldsetPage saves its content into pages under /admin/repeaters, and you cannot move them around like basic data types, as matching data is done using page names of the repeater items and its parent. On 9/19/2017 at 8:28 PM, abdus said: because repeater parents use page and field ids for referencing which repeater items belong to which page and which field. You'll have to clone/move the repeater items to a new location and change their names accordingly. I haven't used the action from @adrian's module as per @bernhard 's recommendation, but it sounds promising. 2 Link to comment Share on other sites More sharing options...
Juergen Posted September 27, 2017 Author Share Posted September 27, 2017 Ok, thanks for your tipps. It is not really necessary to put the fields inside a fieldset(Page) field - it would only save me a lot of time. I will put it inside a default fieldset and copy it as usual. 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