Révision 4853591f
Ajouté par Assos Assos il y a environ 10 ans
drupal7/sites/all/modules/fivestar/fivestar.install | ||
---|---|---|
38 | 38 |
$fields = field_read_fields(array('module' => 'fivestar')); |
39 | 39 |
$tags_numeric = array_values(fivestar_get_tags()); |
40 | 40 |
|
41 |
foreach($fields as $field) { |
|
41 |
foreach ($fields as $field) {
|
|
42 | 42 |
if (is_numeric($field['settings']['axis'])) { |
43 | 43 |
$field['settings']['axis'] = $tags_numeric[$field['settings']['axis']]; |
44 | 44 |
} |
... | ... | |
51 | 51 |
function fivestar_update_7202() { |
52 | 52 |
$fields = field_read_fields(array('module' => 'fivestar')); |
53 | 53 |
|
54 |
foreach($fields as $field) { |
|
54 |
foreach ($fields as $field) {
|
|
55 | 55 |
$instances = field_read_instances(array('field_name' => $field['field_name'])); |
56 |
foreach($instances as $instance) { |
|
56 |
foreach ($instances as $instance) {
|
|
57 | 57 |
$instance['settings'] = $field['settings']; |
58 | 58 |
field_update_instance($instance); |
59 | 59 |
} |
... | ... | |
77 | 77 |
$tags_exploded = explode(',', $tags_txt); |
78 | 78 |
|
79 | 79 |
$tags = array(); |
80 |
$got_vote = false;
|
|
80 |
$got_vote = FALSE;
|
|
81 | 81 |
foreach ($tags_exploded as $tag) { |
82 | 82 |
$tag_trimmed = trim($tag); |
83 | 83 |
if ($tag_trimmed) { |
84 | 84 |
$tags[] = $tag_trimmed; |
85 | 85 |
if ($tag_trimmed == 'vote') { |
86 |
$got_vote = true;
|
|
86 |
$got_vote = TRUE;
|
|
87 | 87 |
} |
88 | 88 |
} |
89 | 89 |
} |
... | ... | |
93 | 93 |
} |
94 | 94 |
$tags; |
95 | 95 |
|
96 |
foreach($tags as $tag) { |
|
96 |
foreach ($tags as $tag) {
|
|
97 | 97 |
$suffix = ''; |
98 |
foreach($types as $type) { |
|
98 |
foreach ($types as $type) {
|
|
99 | 99 |
$var_suffix = $type . ($tag == 'vote' ? '' : '_' . $tag); |
100 | 100 |
|
101 | 101 |
$settings = array( |
102 | 102 |
'stars' => variable_get('fivestar_stars_' . $var_suffix, 6), |
103 | 103 |
'allow_clear' => variable_get('fivestar_unvote_' . $var_suffix, 0), |
104 |
'feedback_enable' => variable_get('fivestar_feedback_'. $var_suffix, 1), |
|
104 |
'feedback_enable' => variable_get('fivestar_feedback_' . $var_suffix, 1),
|
|
105 | 105 |
'style' => variable_get('fivestar_style_' . $var_suffix, 'average'), |
106 | 106 |
'text' => variable_get('fivestar_text_' . $var_suffix, 'dual'), |
107 | 107 |
); |
... | ... | |
112 | 112 |
$field = field_read_field($field_name . $suffix, array('include_deleted' => TRUE)); |
113 | 113 |
|
114 | 114 |
$i = 0; |
115 |
while(!empty($field) && $field['type'] != 'fivestar') { |
|
115 |
while (!empty($field) && $field['type'] != 'fivestar') {
|
|
116 | 116 |
$suffix = '_' . $i; |
117 | 117 |
$field = field_read_field($field_name . $suffix, array('include_deleted' => TRUE)); |
118 | 118 |
$i++; |
... | ... | |
178 | 178 |
*/ |
179 | 179 |
function fivestar_update_7204() { |
180 | 180 |
$fields = field_read_fields(array('type' => 'fivestar')); |
181 |
foreach($fields as $field) { |
|
181 |
foreach ($fields as $field) {
|
|
182 | 182 |
// Iterate through the instances of the field. |
183 | 183 |
$instances = field_read_instances(array('field_name' => $field['field_name'])); |
184 |
foreach($instances as $instance) { |
|
184 |
foreach ($instances as $instance) {
|
|
185 | 185 |
// The default should be to not allow clearing. |
186 | 186 |
$instance['settings']['allow_clear'] = FALSE; |
187 | 187 |
// Check each of the displays on the field instance an convert the formatter |
188 | 188 |
// from fivestar_formatter_exposed_stars to fivestar_formatter_default. |
189 |
foreach($instance['display'] as $key => $display) { |
|
189 |
foreach ($instance['display'] as $key => $display) {
|
|
190 | 190 |
if ($display['type'] == 'fivestar_formatter_exposed_stars') { |
191 | 191 |
// Convert the formatter and set the exposed settings. |
192 | 192 |
$instance['display'][$key]['type'] == 'fivestar_formatter_default'; |
... | ... | |
214 | 214 |
*/ |
215 | 215 |
function fivestar_update_7205() { |
216 | 216 |
$fields = field_read_fields(array('type' => 'fivestar')); |
217 |
foreach($fields as $field) { |
|
217 |
foreach ($fields as $field) {
|
|
218 | 218 |
// Iterate through the instances of the field. |
219 | 219 |
$instances = field_read_instances(array('field_name' => $field['field_name'])); |
220 |
foreach($instances as $instance) { |
|
220 |
foreach ($instances as $instance) {
|
|
221 | 221 |
// If the widget type is select, lets change it. |
222 | 222 |
if ($instance['widget']['type'] == 'select') { |
223 | 223 |
$instance['widget']['type'] = 'fivestar_select'; |
Formats disponibles : Unified diff
Weekly update of contrib modules