Enum label lookup

In your datamodel you might have a Enum field such as this date-based dropdown:

public static $db = array(
"Year" => "Enum('2013, 2014, 2015')"
}

Internally, SilverStripe stores the index, so that when you retrieve the value in methods such as onBeforeWrite, instead of 2013 you will receive 1. Use the function below to retrieve the label of the Enum:

public function EnumLabel($field_name) {
$enumValues = $this->dbObject($field_name)->enumValues();
$label = $enumValues[$this->$field_name];
return $label;
}