cjx2240 Posted September 8, 2020 Share Posted September 8, 2020 How might I populate a page reference multi-select field (with options limited to pages of a specific parent) using the API? I'm doing some manual data importing and I have some categories in json like this (which came from the first-party Export/Import module) "categories": [ "/categories/dance/", "/categories/film/", "/categories/poetry/" ], The pages are all set up correctly on the source site, with the same names I've done images, repeaters etc, but I'm not clear on the syntax for populating a pagereference field. Something like $page->categories->add($category); (Where category is that path from the loop) Is what I was hoping for Link to comment Share on other sites More sharing options...
cjx2240 Posted September 8, 2020 Author Share Posted September 8, 2020 As is so often the case from the magic of rubber duck programming, I realised that $category needs to be the page I've made. While ProcessPageExportImport probably does something clever with those paths, in my case I needed $page->categories->add($pages->get("path=$category")); 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