Projet

Général

Profil

Révision 950416da

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

Weekly update of contrib modules

Voir les différences:

drupal7/sites/all/modules/rules/modules/events.inc
1 1
<?php
2 2

  
3 3
/**
4
 * @file Invokes events on behalf core modules. Usually this should be
5
 *   directly in the module providing rules integration instead.
4
 * @file
5
 * Invokes events on behalf core modules.
6
 *
7
 * For non-core modules, the code to invoke events should be found in the
8
 * module providing rules integration.
6 9
 *
7 10
 * @addtogroup rules
11
 *
8 12
 * @{
9 13
 */
10 14

  
11

  
12 15
/**
13
 * Gets an unchanged entity that doesn't contain any recent changes. This
14
 * handler assumes the name of the variable for the changed entity is the same
15
 * as for the unchanged entity but without the trailing "_unchanged"; e.g., for
16
 * the "node_unchanged" variable the handler assumes there is a "node" variable.
16
 * Gets an unchanged entity that doesn't contain any recent changes.
17
 *
18
 * This handler assumes the name of the variable for the changed entity is the
19
 * same as for the unchanged entity but without the trailing "_unchanged"; e.g.,
20
 * for the "node_unchanged" variable the handler assumes there is a "node"
21
 * variable.
17 22
 */
18 23
function rules_events_entity_unchanged($arguments, $name, $info) {
19 24
  // Cut of the trailing _unchanged.
......
24 29
  }
25 30
}
26 31

  
27
/**
32
/*
28 33
 * Generic entity events, used for core-entities for which we provide Rules
29
 * integration only.
30
 * We are implementing the generic-entity hooks instead of the entity-type
31
 * specific hooks to ensure we come last. See http://drupal.org/node/1211946
32
 * for details.
34
 * integration only. We are implementing the generic-entity hooks instead of
35
 * the entity-type specific hooks to ensure we come last.
36
 * See https://www.drupal.org/node/1211946 for details.
33 37
 */
34 38

  
35 39
/**
......
41 45
      rules_invoke_event('comment_view--' . $entity->node_type, $entity, $view_mode);
42 46
      rules_invoke_event('comment_view', $entity, $view_mode);
43 47
      break;
48

  
44 49
    case 'node':
45 50
      rules_invoke_event('node_view--' . $entity->type, $entity, $view_mode);
46 51
      rules_invoke_event('node_view', $entity, $view_mode);
47 52
      break;
53

  
48 54
    case 'user':
49 55
      rules_invoke_event('user_view', $entity, $view_mode);
50 56
      break;
......
60 66
      rules_invoke_event('comment_presave--' . $entity->node_type, $entity);
61 67
      rules_invoke_event('comment_presave', $entity);
62 68
      break;
69

  
63 70
    case 'node':
64 71
      rules_invoke_event('node_presave--' . $entity->type, $entity);
65 72
      rules_invoke_event('node_presave', $entity);
66 73
      break;
74

  
67 75
    case 'taxonomy_term':
68 76
      rules_invoke_event('taxonomy_term_presave--' . $entity->vocabulary_machine_name, $entity);
69 77
      rules_invoke_event('taxonomy_term_presave', $entity);
70 78
      break;
79

  
71 80
    case 'taxonomy_vocabulary':
72 81
    case 'user':
73 82
      rules_invoke_event($type . '_presave', $entity);
......
84 93
      rules_invoke_event('comment_update--' . $entity->node_type, $entity);
85 94
      rules_invoke_event('comment_update', $entity);
86 95
      break;
96

  
87 97
    case 'node':
88 98
      rules_invoke_event('node_update--' . $entity->type, $entity);
89 99
      rules_invoke_event('node_update', $entity);
90 100
      break;
101

  
91 102
    case 'taxonomy_term':
92 103
      rules_invoke_event('taxonomy_term_update--' . $entity->vocabulary_machine_name, $entity);
93 104
      rules_invoke_event('taxonomy_term_update', $entity);
94 105
      break;
106

  
95 107
    case 'taxonomy_vocabulary':
96 108
    case 'user':
97 109
      rules_invoke_event($type . '_update', $entity);
......
108 120
      rules_invoke_event('comment_insert--' . $entity->node_type, $entity);
109 121
      rules_invoke_event('comment_insert', $entity);
110 122
      break;
123

  
111 124
    case 'node':
112 125
      rules_invoke_event('node_insert--' . $entity->type, $entity);
113 126
      rules_invoke_event('node_insert', $entity);
114 127
      break;
128

  
115 129
    case 'taxonomy_term':
116 130
      rules_invoke_event('taxonomy_term_insert--' . $entity->vocabulary_machine_name, $entity);
117 131
      rules_invoke_event('taxonomy_term_insert', $entity);
118 132
      break;
133

  
119 134
    case 'taxonomy_vocabulary':
120 135
    case 'user':
121 136
      rules_invoke_event($type . '_insert', $entity);
......
132 147
      rules_invoke_event('comment_delete--' . $entity->node_type, $entity);
133 148
      rules_invoke_event('comment_delete', $entity);
134 149
      break;
150

  
135 151
    case 'node':
136 152
      rules_invoke_event('node_delete--' . $entity->type, $entity);
137 153
      rules_invoke_event('node_delete', $entity);
138 154
      break;
155

  
139 156
    case 'taxonomy_term':
140 157
      rules_invoke_event('taxonomy_term_delete--' . $entity->vocabulary_machine_name, $entity);
141 158
      rules_invoke_event('taxonomy_term_delete', $entity);
142 159
      break;
160

  
143 161
    case 'taxonomy_vocabulary':
144 162
    case 'user':
145 163
      rules_invoke_event($type . '_delete', $entity);
......
161 179
  rules_invoke_event('user_logout', $account);
162 180
}
163 181

  
164
/**
165
 * System events. Note that rules_init() is the main module file is used to
182
/*
183
 * System events.
184
 *
185
 * Note that rules_init() is the main module file is used to
166 186
 * invoke the init event.
167 187
 */
168 188

  
......
184 204
 * Getter callback for the log entry message property.
185 205
 */
186 206
function rules_system_log_get_message($log_entry) {
187
  return t($log_entry['message'], (array)$log_entry['variables']);
207
  return t($log_entry['message'], (array) $log_entry['variables']);
188 208
}
189 209

  
190 210
/**

Formats disponibles : Unified diff