Jump to content

Recommended Posts

Posted

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?

Posted

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
}
  • Like 5

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
  • Recently Browsing   0 members

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