You are here

function datex_datex_format_alter in Datex 7

Same name and namespace in other branches
  1. 7.2 datex.module \datex_datex_format_alter()

Implements hook_datex_format_alter().

This hook is not available unless Drupal core is patched with provided patch in datex module's directory. I tried to keep the patch as small as possible, Just a drupal_alter for date_format function, As we all know patch for core is BAD man, it's bad... Benchmarks were good also, Not much performance difference after appying patch. More benchmarking needed though.

File

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

Code

function datex_datex_format_alter(&$data, $context) {
  if (_datex_skip_language($context['langcode']) || _datex_integration_mode(DATEX_THEMING_METHOD)) {
    return;
  }
  $tz = DatexFormatter::getTzObject($context['timezone']);
  $data = DatexFormatter::format($context['timestamp'], $context['format'], $tz, _datex_intl());
}