Array vs singular values from content and config inputs

Please make all config inputs and content type inputs return arrays when the occurrences maximum is not 1.

Most of the inputs I’ve created allow only a single value and it’s easy to use this string or whatever singular value. But any input that could return more than one should return the result as an array, even when there is only one result. Site developers know when an input could return more than one and we have to deal with these results as an array. But because these inputs might also return a non-array result, we always have to check and then turn the singulars into arrays manually. And the util.log() doesn’t seem to show it correctly after it’s changed.

I’m sure this will be a big point of confusion for people learning to use EXP due to unexpected results. I’ve been working with it for a long time and I still forget sometimes and it causes delays and frustration.

1 Like

Hi Michael,

The content type schemas are detached from the actual data, so we cannot use occurences for this purpose. Simple solution for this, if you are unsure what will be returned is a simple util method that actually testes for arrays - i believe one such method was made by @tlo in the util lib.

This is added to the util lib.