You are here

function datex_preprocess_node in Datex 7.2

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

Implements hook_preprocess_node().

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

File

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

Code

function datex_preprocess_node(&$variables) {
  $fmt = _datex_cfg('node_fmt');
  if (!($calendar = _datex_factory($variables['created'], $fmt, DATEX_NONPATCHING_MODE))) {
    return;
  }
  $variables['date'] = $calendar
    ->format();
  if (isset($variables['display_submitted'])) {
    $variables['submitted'] = t('Submitted by !username on !datetime', array(
      '!username' => $variables['name'],
      '!datetime' => $variables['date'],
    ));
  }
}