source: sipes/modules_contrib/views/modules/statistics.views_convert.inc @ a8b1f3f

stableversion-3.0
Last change on this file since a8b1f3f was 177a560, checked in by José Gregorio Puentes <jpuentes@…>, 8 años ago

se agrego el directorio de modulos contribuidos de drupal

  • Propiedad mode establecida a 100644
File size: 1.7 KB
Línea 
1<?php
2
3/**
4 * @file
5 * Field conversion for fields handled by this module.
6 */
7
8/**
9 * Implementation of hook_views_convert().
10 *
11 * Intervene to convert field values from the Views 1 format to the
12 * Views 2 format. Intervene only if $view->add_item() won't produce
13 * the right results, usually needed to set field options or values.
14 */
15function statistics_views_convert($display, $type, &$view, $field, $id = NULL) {
16  switch ($type) {
17    case 'field':
18      switch ($field['tablename']) {
19        case 'node_counter':
20          switch ($field['field']) {
21            case 'timestamp':
22              $handlers = array(
23                'views_handler_field_date_small' => 'small',
24                'views_handler_field_date' => 'medium',
25                'views_handler_field_date_large' => 'large',
26                'views_handler_field_date_custom' => 'custom',
27                'views_handler_field_since' => 'time ago',
28              );
29              $view->set_item_option($display, 'field', $id, 'date_format', $handlers[$field['handler']]);
30              if (!empty($field['options'])) {
31                $view->set_item_option($display, 'field', $id, 'custom_date_format', $field['options']);
32              }
33              break;
34          }
35          break;
36      }
37      break;
38    case 'sort':
39      switch ($field['tablename']) {
40        case 'node_counter':
41          switch ($field['field']) {
42            case 'timestamp':
43              $field['options'] = $field['options'] == 'normal' ? 'second' : $field['options'];
44              $view->set_item_option($display, 'sort', $id, 'granularity', $field['options']);
45              break;
46          }
47          break;
48      }
49      break;
50  }
51}
Nota: Vea TracBrowser para ayuda de uso del navegador del repositorio.