Projet

Général

Profil

Révision 599a39cd

Ajouté par Assos Assos il y a environ 3 ans

Weekly update of contrib modules

Voir les différences:

drupal7/sites/all/modules/date/date_context/plugins/date_context_date_condition.inc
2 2

  
3 3
/**
4 4
 * @file
5
 * Context date condition plugin.
5
 * Context condition plugin for date values.
6 6
 */
7 7

  
8 8
/**
9
 * Expose term views/term forms by vocabulary as a context condition.
9
 * Context condition plugin for date values.
10 10
 */
11
// @codingStandardsIgnoreStart
12 11
class date_context_date_condition extends context_condition_node {
13 12

  
14 13
  /**
......
71 70
        $fields = $this->fetch_from_context($context, 'values');
72 71

  
73 72
        foreach ($fields as $field_name => $label) {
74

  
75 73
          // If this field does not exist on this entity, just move along.
76 74
          if (empty($entity->{$field_name})) {
77 75
            continue;
......
79 77

  
80 78
          $items = field_get_items('node', $entity, $field_name);
81 79

  
82
          // If there are no values, nothing to do unless we were looking for 'empty' or '!='.
80
          // If there are no values, nothing to do unless we were looking for
81
          // 'empty' or '!='.
83 82
          if (empty($items)) {
84 83
            if ($options['operation'] == '!=' || $options['operation'] == 'empty') {
85 84
              $this->condition_met($context, $field_name);
86 85
            }
87 86
          }
88 87

  
89
          // We don't have to construct the date values if we're just testing for 'not empty'.
88
          // We don't have to construct the date values if we're just testing
89
          // for 'not empty'.
90 90
          elseif ($options['operation'] == 'not empty') {
91 91
            $this->condition_met($context, $field_name);
92 92
          }
93 93

  
94
          // All other operations need to retrieve the date values for comparision.
94
          // All other operations need to retrieve the date values for
95
          // comparision.
95 96
          else {
96 97
            $field = field_info_field($field_name);
97 98
            $timezone_db = date_get_timezone_db($field['settings']['tz_handling']);
......
152 153
      }
153 154
    }
154 155
  }
156

  
155 157
}
156
// @codingStandardsIgnoreEnd

Formats disponibles : Unified diff