You are here

function datex_preprocess_comment in Datex 7.2

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

Implements hook_preprocess_comment().

Localizes 'published on' date in non-patching mode.

File

./datex.module, line 202
Convert output of date_format() to Jalali in a patched drupal installation.

Code

function datex_preprocess_comment(&$variables) {
  $calendar = $variables['elements']['#comment']->created;
  $cfg = _datex_cfg('comment_fmt');
  if (!($calendar = _datex_factory($calendar, $cfg, DATEX_NONPATCHING_MODE))) {
    return;
  }

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