Robin S Posted December 2, 2015 Share Posted December 2, 2015 I have several Page fields in my template, some are "multiple page" fields and some are "single page" fields. When looping through my template fields I need to also foreach the multiple page fields. What is a good way to test for multiple vs single page fields? Or if I know I want to loop through my Page fields is it better to set them all to dereference as PageArrays? Link to comment Share on other sites More sharing options...
teppo Posted December 2, 2015 Share Posted December 2, 2015 Not sure if I'm getting your question right, but why not simply check if the value of the field is an instance of PageArray: if ($page->field_name instanceof PageArray) { // iterate } 5 Link to comment Share on other sites More sharing options...
Robin S Posted December 2, 2015 Author Share Posted December 2, 2015 Thanks, that does the trick. 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