Change field value display in Module form (form_fields)
What I'm trying to do:
I have a field in my DB 'last_login' which is an int(11) field, which holds a epoch_timestamp.
In the Module record edit display I want to show this field, but not allow editing. But I'd like to display a friendly date, not the epoch timestamp.
What I've done:
[code]
function form_fields($values)
{
$fields = parent::form_fields($values);
$values['last_login'] = date('m/d/Y', $values['last_login']);
$fields['last_login'] = array('value' => $values['last_login'],'displayonly' => true);
return $fields;
}
[/code]
I would expect to see in the edit form:
Last Login: 7/13/2013
but I'm still seeing the timestamp, not the friendly date.
Is it possible to set a field value in the form_fields method?
(using 1.0 branch, last merge from github: SHA 9dff5bd)
Comments