function jalalidate_handler_field_date::render in PersianTools 7
Render the field.
Parameters
array $values: The values retrieved from the database.
Overrides views_handler_field_date::render
File
- includes/
jalalidate_handler_field_date.inc, line 20 - A custom two-part date field handler for Views.
Class
- jalalidate_handler_field_date
- A handler to display dates in two different formats, based on an offset from the current time.
Code
function render($values) {
$type = $this->options['date_format'];
$value = $values->{$this->field_alias};
if (in_array($type, array(
'raw time ago',
'time ago',
'raw time span',
'time span',
))) {
return parent::render($values);
}
if ($type == 'custom') {
$format = $this->options['custom_date_format'];
}
else {
$format = variable_get('date_format_' . $type);
}
$time = jalalidate_convert_format($value, $format);
return $time;
}