You are here

function datex_preprocess_comment in Datex 7.3

Same name and namespace in other branches
  1. 7 datex.module \datex_preprocess_comment()
  2. 7.2 datex.module \datex_preprocess_comment()

Implements hook_preprocess_comment().

Localizes 'published on' date.

Parameters

$variables:

File

./datex.module, line 363
Datex main module file, Datex adds php-intl support to drupal.

Code

function datex_preprocess_comment(&$variables) {
  $calendar = datex_factory();
  if (!$calendar) {
    return;
  }
  $calendar
    ->setTimestamp($variables['elements']['#comment']->created);

  // Timestamp set while calling factory.
  $fmt = variable_get('date_format_medium', '');
  $variables['changed'] = $calendar
    ->format($fmt);
  $calendar
    ->setTimestamp($variables['elements']['#comment']->created);
  $variables['created'] = $calendar
    ->format($fmt);
  $variables['submitted'] = t('Submitted by !username on !datetime', [
    '!username' => $variables['author'],
    '!datetime' => $variables['created'],
  ]);
}