Panel field with multiple inputs to change subpage's data

Hey guys,

currently I’m building a custom panel field for a client, which should make it possible to edit the same data of different pages at once. So far I’ve build up a table with the different input fields in it – but I’m struggling how to process the data the right way… my first thought was to save the data as usual into the parents page (where the field is placed) and then use the panel-update-hook to update each subpage. Do you think this might work? Or should I go another way, maybe via an AJAX-called script? Or has someone did this before?

Thanks for your help guys,

If you want the data to be editable in the parent page, you will have to save it to that page anyway. Why would you want to save the data to the subpages at all?

I’m not sure I understand the use case where this would be necessary indeed.
You could simply use it in your subpages


Just wanted to write the same. I think the best way would be to only store the data in the parent page and then access it dynamically in the child pages. Please note that this kind of field might easily break, for example when child pages are renamed or deleted.

Thank you all for the answers – you might be right with saving everything to the parent’s page. I’ll mark this as solved :slight_smile:

I had a second though about this and can think of a scenario that would make sense:
A default inherited from the parent and optionaly overwritten by the child.

In this case, I’d still recommend only saving the default to the parent page and leaving an empty field on the child page that will only overwrite the parent data if used.

e($page->your_field()->isEmpty(), $page->parent()->your_field() , $page->your_field());