I'm trying to pull out enum values from a dataobject to act as a menu/filter. I have not been able to find any documentation on how to do this and my attempts have all failed.
For example I have:
class Specification extends DataObject {
private static $db = array (
'Standard' => 'Enum("BS 1400,AS 1565")'
);
}
I'm trying to do something like:
public function Standards() {
$stnds = Specification::get()->dbObject('Standard')->enumValues();
$list = ArrayList::create();
foreach ($stnds as $stnd) {
$list->push($stnd);
}
return $list;
}
I want to be able to loop the resulting values in the template, but can't access the labels - if I do:
<% loop Standards %>
$Pos
<% end_loop %>
This gives me 1 2, which suggests it is working, but cannot access the enum value labels in the template.
How do I correctly return these values so they can be looped through in the template?