Jump to content

How to copy fieldset(Page) values via API to a child page


Juergen
 Share

Recommended Posts

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

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.

image.png.d60e0ffa7aff1c74b2b869f6efb20742.png

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.

  • Like 2
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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...