function filefield_meta_handler_field_duration::render in FileField 6.3
File
- filefield_meta/
includes/ filefield_meta_handler_field_duration.inc, line 47 - A special handler that properly formats duration fields as minutes:seconds.
Class
- filefield_meta_handler_field_duration
- Render a field as a readable value in hours, minutes, and seconds.
Code
function render($values) {
$value = $values->{$this->field_alias};
switch ($this->options['format']) {
case 'hours':
$output = date('g', (int) $value);
break;
case 'minutes':
$output = date('i', (int) $value);
break;
case 'seconds':
$output = date('s', (int) $value);
break;
case 'total':
$output = check_plain($value);
break;
default:
$output = theme('filefield_meta_duration', $value);
}
// Check to see if hiding should happen before adding prefix and suffix.
if ($this->options['hide_empty'] && empty($value) && ($value !== 0 || $this->options['empty_zero'])) {
return '';
}
return check_plain($this->options['prefix']) . $output . check_plain($this->options['suffix']);
}