You are here

public function datex_handler_field_date::render in Datex 7

Same name and namespace in other branches
  1. 7.2 views/datex_handler_field_date.inc \datex_handler_field_date::render()

Called by views to render field.

Overrides views_handler_field_date::render

File

views/datex_handler_field_date.inc, line 14
Datex date formatter for views.

Class

datex_handler_field_date
Date field handler for views with datex support.

Code

public function render($values) {
  static $check_array = array(
    'raw time ago',
    'time ago',
    'raw time hence',
    'time hence',
    'raw time span',
    'inverse time span',
    'time span',
  );
  $format = $this->options['date_format'];

  // In this cases, Everything will be handled properly by parent and there
  // is no need for datex to interfere with views original handler.
  if (_datex_skip_language() || in_array($format, $check_array) || _datex_integration_mode(DATEX_PATCHING_METHOD)) {
    return parent::render($values);
  }
  if ($value = $this
    ->get_value($values)) {
    $format = $format === 'custom' ? $this->options['custom_date_format'] : variable_get('date_format_' . $format);
    $timezone = !empty($this->options['timezone']) ? $this->options['timezone'] : drupal_get_user_timezone();
    return DatexFormatter::format($value, $format, $timezone, _datex_intl());
  }
}