Projet

Général

Profil

Révision b720ea3e

Ajouté par Assos Assos il y a plus de 8 ans

Weekly update of contrib modules

Voir les différences:

drupal7/sites/all/modules/date/date_views/includes/date_views_fields.inc
5 5
 */
6 6

  
7 7
/**
8
 *  Identify all potential date/timestamp fields.
8
 * Identify all potential date/timestamp fields.
9 9
 *
10
 *  @return
11
 *    array with fieldname, type, and table.
12
 *  @see
13
 *    date_views_date_views_fields() which implements
14
 *    the hook_date_views_fields() for the core date fields.
10
 * @return array
11
 *   An array with fieldname, type, and table.
12
 * @see date_views_date_views_fields()
15 13
 */
16 14
function _date_views_fields($base = 'node') {
17 15

  
......
60 58
    $handler = views_get_handler($table_name, $field_name, 'filter');
61 59
    $handler_name = $handler->definition['handler'];
62 60

  
63
    // We don't care about anything but date handlers
61
    // We don't care about anything but date handlers.
64 62
    if (empty($handler->definition['is date'])) {
65 63
      continue;
66 64
    }
......
72 70
      $field = field_info_field($handler->definition['field_name']);
73 71
      $is_field = TRUE;
74 72
      switch ($field['type']) {
75
       case 'date':
73
        case 'date':
76 74
          $sql_type = DATE_ISO;
77 75
          break;
76

  
78 77
        case 'datestamp':
79 78
          break;
79

  
80 80
        case 'datetime':
81 81
          $sql_type = DATE_DATETIME;
82 82
          break;
83

  
83 84
        default:
84 85
          // If this is not a date field, nothing more to do.
85 86
          continue;
......
88 89
      $revision = in_array($base, array('node_revision')) ? FIELD_LOAD_REVISION : FIELD_LOAD_CURRENT;
89 90
      $db_info = date_api_database_info($field, $revision);
90 91
      $name = $table_name . "." . $field_name;
91
      $granularity = !empty($field['granularity']) ? $field['granularity'] : array('year', 'month', 'day', 'hour', 'minute', 'second');
92
      $grans = array('year', 'month', 'day', 'hour', 'minute', 'second');
93
      $granularity = !empty($field['granularity']) ? $field['granularity'] : $grans;
92 94

  
93 95
      $fromto = array(
94 96
        $table_name . '.' . $db_info['columns'][$table_name]['value'],

Formats disponibles : Unified diff