rooofl Posted April 5, 2020 Share Posted April 5, 2020 Hello, I am trying to add a page to Page Reference field. Here is what I do: $testpage = $pages->get(1252); // Page to edit $designersField = $testpage->designers; // Page field to fill $designerArray = []; $toadd = $pages->get(1200); // Page to add array_push($designerArray, $toadd); $designersField = PageArray($designerArray); // $testpage->save(); should I save? var_dump($designersField); When I var_dump() the page, I can see that my `designer` page has been aded. However in the admin page view, nothing is listed in the AsmSelect field. What do I miss? Link to comment Share on other sites More sharing options...
elabx Posted April 5, 2020 Share Posted April 5, 2020 Yes, save the page! $testpage->of(false); $testpage->save(); Link to comment Share on other sites More sharing options...
rooofl Posted April 5, 2020 Author Share Posted April 5, 2020 Saving the page doesn’t solve my problem… Link to comment Share on other sites More sharing options...
adrian Posted April 5, 2020 Share Posted April 5, 2020 $testpage = $pages->get(1252); $tespage->of(false); $testpage->designers->add(1200); $testpage->save('designers'); 1 Link to comment Share on other sites More sharing options...
rooofl Posted April 6, 2020 Author Share Posted April 6, 2020 Thank you both, I didn’t understand the use of of(false). 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