I'm not sure if this is a bug or if I'm doing something wrong here. If you manually enter the options, the following applies:
"Enter one value per line, in the format key|label."

This does not seem to apply when choosing PHP Code to return an array. If I return my values in the form of key|label in an array it will print just that in the dropdown. I tried filling the array with $option[][key] and $option[][label]s but that doesn't work either.

So in short: is it possible to define a label and key when using PHP Code, and if not: was this intended or is it a bug?

Comments

wmostrey’s picture

Status: Active » Closed (works as designed)

Thanks to chx for pointing me out that the correct way of handling this is to use $items[$key]=$label;

StephenRobinson’s picture

I have found the best way of implementing this is to create a view that produces the key|label syntax, then steal the sql statement.