jalalidate_viewsformatter.module in PersianTools 7
File
jalalidate_viewsformatter/jalalidate_viewsformatter.module
View source
<?php
function jalalidate_viewsformatter_views_api() {
return array(
'api' => 3,
'path' => drupal_get_path('module', 'jalalidate_viewsformatter'),
);
}
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;
}
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',
),
),
);
}