Jump to content

Recommended Posts

Posted

In a module-context, as we know, stuff like single file or image fields return 'arrays', i.e. become iterable. This means that directly using WireArray::Iterable() to check whether a field is iterable can be misleading. Other than to temporarily set a page's output formatting to true (still within a module context), checking iterability of a field on the page, then reverting the page's output formatting to false after the check, is there another/a better way to achieve the same feat? Thanks.

 

 

Posted

I think changing the output formatting will be the most reliable way to check if a field is working like our file fields as it's working no matter what you throw at it. I'd imagine anything else being dependent on the actual implementation of each of those fieldtypes.

  • Like 2
Posted

Thanks Benjamin. That's how I am doing it at the moment but was worried I could affect other fields in that short instance I do the check..before reverting back. I was probably being paranoid...:)

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
×
×
  • Create New...