You are here

jalalidate_viewsformatter.module in PersianTools 7

File

jalalidate_viewsformatter/jalalidate_viewsformatter.module
View source
<?php

/**
 * Implements hook_views_api().
 */
function jalalidate_viewsformatter_views_api() {
  return array(
    'api' => 3,
    'path' => drupal_get_path('module', 'jalalidate_viewsformatter'),
  );
}

/**
 * Implements hook_views_data_alter().
 */
function jalalidate_viewsformatter_views_data_alter(&$data) {
  global $language;
  if ($language->name == 'Persian') {
    foreach ($data as $table => $config) {
      foreach ($config as $item => $item_config) {
        if (isset($item_config['field']) && !empty($item_config['field']['handler'])) {
          if ($item_config['field']['handler'] == 'views_handler_field_date') {
            $data[$table][$item]['field']['handler'] = 'jalalidate_handler_field_date';
          }
        }
      }
    }
  }
  return $data;
}

/**
 * Implements hook_views_handlers().
 */
function jalalidate_viewsformatter_views_handlers() {
  return array(
    'info' => array(
      'path' => drupal_get_path('module', 'persiantools') . '/includes',
    ),
    'handlers' => array(
      'jalalidate_handler_field_date' => array(
        'parent' => 'views_handler_field_date',
        'file' => 'jalalidate_handler_field_date.inc',
      ),
    ),
  );
}