You are here

function datex_datex_format_alter in Datex 7.2

Same name and namespace in other branches
  1. 7 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 170
Convert output of date_format() to Jalali in a patched drupal installation.

Code

function datex_datex_format_alter(&$data, $context) {
  $calendar = _datex_language_calendar($context['langcode'], DATEX_PATCHING_MODE);
  if (!$calendar) {
    return;
  }
  $data = datex_format($calendar, $context['timestamp'], $context['format'], $context['timezone']);
}