Révision 9d13637e
Ajouté par Assos Assos il y a plus de 9 ans
drupal7/sites/all/modules/addressfield/addressfield.address_formats.inc | ||
---|---|---|
21 | 21 |
* - locality_label: The label for the locality field. |
22 | 22 |
* - administrative_area_label: The label for the administrative area field. |
23 | 23 |
* - postal_code_label: The label for the postal code field. |
24 |
* |
|
24 |
* - render_administrative_area_value: True if the value should be rendered |
|
25 |
* instead of the ISO code. US example: California instead of CA. |
|
26 |
* Only relevant for countries with predefined administrative areas. |
|
25 | 27 |
*/ |
26 | 28 |
function addressfield_get_address_format($country_code) { |
27 | 29 |
$default_values = array( |
... | ... | |
31 | 33 |
'locality_label' => t('City'), |
32 | 34 |
'administrative_area_label' => t('Province'), |
33 | 35 |
'postal_code_label' => t('Postal code'), |
36 |
'render_administrative_area_value' => FALSE, |
|
34 | 37 |
); |
35 | 38 |
|
36 | 39 |
$address_formats = array(); |
... | ... | |
38 | 41 |
// postal code in 'used_fields'. |
39 | 42 |
$countries_with_optional_postal_code = array( |
40 | 43 |
'AC', 'AD', 'AL', 'AZ', 'BA', 'BB', 'BD', 'BG', 'BH', 'BM', 'BN', 'BT', |
41 |
'CR', 'CY', 'CZ', 'DO', 'DZ', 'EC', 'EE', 'EH', 'ET', 'FO', 'GE', 'GN', |
|
42 |
'GT', 'GW', 'HR', 'HT', 'HU', 'IL', 'IS', 'JO', 'KE', 'KG', 'KH', 'KW', |
|
43 |
'LA', 'LB', 'LK', 'LR', 'LS', 'LT', 'LV', 'MA', 'MC', 'MD', 'ME', 'MG', |
|
44 |
'MK', 'MM', 'MT', 'MU', 'MV', 'NE', 'NP', 'OM', 'PK', 'PY', 'RO', 'RS', |
|
45 |
'SA', 'SI', 'SK', 'SN', 'SZ', 'TA', 'TJ', 'TM', 'TN', 'VA', 'VC', 'VG', |
|
46 |
'XK', 'ZM', |
|
44 |
'CR', 'CY', 'CZ', 'DO', 'DZ', 'EC', 'EH', 'ET', 'FO', 'GE', 'GN', 'GT', |
|
45 |
'GW', 'HR', 'HT', 'HU', 'IL', 'IS', 'JO', 'KE', 'KG', 'KH', 'KW', 'LA', |
|
46 |
'LA', 'LB', 'LK', 'LR', 'LS', 'MA', 'MC', 'MD', 'ME', 'MG', 'MK', 'MM', |
|
47 |
'MT', 'MU', 'MV', 'NE', 'NP', 'OM', 'PK', 'PY', 'RO', 'RS', 'SA', 'SI', |
|
48 |
'SK', 'SN', 'SZ', 'TA', 'TJ', 'TM', 'TN', 'VA', 'VC', 'VG', 'XK', 'ZM', |
|
47 | 49 |
); |
48 | 50 |
foreach ($countries_with_optional_postal_code as $code) { |
49 | 51 |
$address_formats[$code] = array( |
... | ... | |
76 | 78 |
$address_formats['AR'] = array( |
77 | 79 |
'used_fields' => array('locality', 'administrative_area', 'postal_code'), |
78 | 80 |
'administrative_area_label' => t('State', array(), array('context' => 'Territory of a country')), |
81 |
'render_administrative_area_value' => TRUE, |
|
79 | 82 |
); |
80 | 83 |
$address_formats['AS'] = array( |
81 | 84 |
'used_fields' => array('locality', 'administrative_area', 'postal_code'), |
... | ... | |
113 | 116 |
$address_formats['CL'] = array( |
114 | 117 |
'used_fields' => array('locality', 'administrative_area', 'postal_code'), |
115 | 118 |
'administrative_area_label' => t('State', array(), array('context' => 'Territory of a country')), |
119 |
'render_administrative_area_value' => TRUE, |
|
116 | 120 |
); |
117 | 121 |
$address_formats['CN'] = array( |
118 | 122 |
'used_fields' => array('dependent_locality', 'locality', 'administrative_area', 'postal_code'), |
119 |
'required_fields' => array('locality', 'administrative_area', 'postal_code'),
|
|
123 |
'required_fields' => array('locality', 'administrative_area'), |
|
120 | 124 |
'dependent_locality_label' => t('District'), |
121 | 125 |
); |
122 | 126 |
$address_formats['CO'] = array( |
... | ... | |
134 | 138 |
'used_fields' => array('locality', 'administrative_area', 'postal_code'), |
135 | 139 |
'administrative_area_label' => t('Governorate'), |
136 | 140 |
); |
141 |
$address_formats['EE'] = array( |
|
142 |
'used_fields' => array('locality', 'administrative_area', 'postal_code'), |
|
143 |
'required_fields' => array('locality', 'postal_code'), |
|
144 |
'administrative_area_label' => t('County'), |
|
145 |
); |
|
137 | 146 |
$address_formats['ES'] = array( |
138 | 147 |
'used_fields' => array('locality', 'administrative_area', 'postal_code'), |
139 | 148 |
'required_fields' => array('locality', 'administrative_area', 'postal_code'), |
149 |
'render_administrative_area_value' => TRUE, |
|
140 | 150 |
); |
141 | 151 |
$address_formats['FM'] = array( |
142 | 152 |
'used_fields' => array('locality', 'administrative_area', 'postal_code'), |
... | ... | |
173 | 183 |
$address_formats['ID'] = array( |
174 | 184 |
'used_fields' => array('locality', 'administrative_area', 'postal_code'), |
175 | 185 |
'locality_label' => t('City/Regency'), |
186 |
'render_administrative_area_value' => TRUE, |
|
176 | 187 |
); |
177 | 188 |
$address_formats['IE'] = array( |
178 | 189 |
'used_fields' => array('locality', 'administrative_area'), |
179 | 190 |
'locality_label' => t('Town/City'), |
180 | 191 |
'administrative_area_label' => t('County'), |
192 |
'render_administrative_area_value' => TRUE, |
|
181 | 193 |
); |
182 | 194 |
$address_formats['IN'] = array( |
183 | 195 |
'used_fields' => array('locality', 'administrative_area', 'postal_code'), |
184 | 196 |
'required_fields' => array('locality', 'administrative_area', 'postal_code'), |
185 | 197 |
'administrative_area_label' => t('State', array(), array('context' => 'Territory of a country')), |
186 | 198 |
'postal_code_label' => t('PIN code'), |
199 |
'render_administrative_area_value' => TRUE, |
|
187 | 200 |
); |
188 | 201 |
$address_formats['IQ'] = array( |
189 | 202 |
'used_fields' => array('locality', 'administrative_area', 'postal_code'), |
... | ... | |
201 | 214 |
'used_fields' => array('locality', 'administrative_area'), |
202 | 215 |
'required_fields' => array('locality', 'administrative_area'), |
203 | 216 |
'administrative_area_label' => t('Parish', array(), array('context' => 'Territory of a country')), |
217 |
'render_administrative_area_value' => TRUE, |
|
204 | 218 |
); |
205 | 219 |
$address_formats['JP'] = array( |
206 | 220 |
'used_fields' => array('locality', 'administrative_area', 'postal_code'), |
207 | 221 |
'required_fields' => array('locality', 'administrative_area', 'postal_code'), |
208 | 222 |
'administrative_area_label' => t('Prefecture'), |
223 |
'render_administrative_area_value' => TRUE, |
|
209 | 224 |
); |
210 | 225 |
$address_formats['KI'] = array( |
211 | 226 |
'used_fields' => array('locality', 'administrative_area'), |
... | ... | |
228 | 243 |
); |
229 | 244 |
$address_formats['KZ'] = array( |
230 | 245 |
'used_fields' => array('locality', 'administrative_area', 'postal_code'), |
246 |
'required_fields' => array('locality', 'administrative_area', 'postal_code'), |
|
247 |
'administrative_area_label' => t('Region', array(), array('context' => 'Territory of a country')), |
|
248 |
); |
|
249 |
$address_formats['LT'] = array( |
|
250 |
'used_fields' => array('locality', 'administrative_area', 'postal_code'), |
|
251 |
'required_fields' => array('locality', 'postal_code'), |
|
252 |
'administrative_area_label' => t('County'), |
|
253 |
); |
|
254 |
$address_formats['LV'] = array( |
|
255 |
'used_fields' => array('locality', 'administrative_area', 'postal_code'), |
|
256 |
'required_fields' => array('locality', 'postal_code'), |
|
257 |
'administrative_area_label' => t('Municipality'), |
|
231 | 258 |
); |
232 | 259 |
$address_formats['MH'] = array( |
233 | 260 |
'used_fields' => array('locality', 'administrative_area', 'postal_code'), |
... | ... | |
255 | 282 |
'required_fields' => array('locality', 'postal_code'), |
256 | 283 |
'dependent_locality_label' => t('Village / Township'), |
257 | 284 |
'administrative_area_label' => t('State', array(), array('context' => 'Territory of a country')), |
285 |
'render_administrative_area_value' => TRUE, |
|
258 | 286 |
); |
259 | 287 |
$address_formats['MZ'] = array( |
260 | 288 |
'used_fields' => array('locality', 'administrative_area', 'postal_code'), |
... | ... | |
346 | 374 |
'used_fields' => array('locality', 'administrative_area', 'postal_code'), |
347 | 375 |
'required_fields' => array('locality', 'postal_code'), |
348 | 376 |
'locality_label' => t('District'), |
377 |
'render_administrative_area_value' => TRUE, |
|
349 | 378 |
); |
350 | 379 |
$address_formats['TV'] = array( |
351 | 380 |
'used_fields' => array('locality', 'administrative_area'), |
... | ... | |
381 | 410 |
$address_formats['VE'] = array( |
382 | 411 |
'used_fields' => array('locality', 'administrative_area', 'postal_code'), |
383 | 412 |
'required_fields' => array('locality', 'administrative_area'), |
413 |
'render_administrative_area_value' => TRUE, |
|
384 | 414 |
); |
385 | 415 |
$address_formats['VI'] = array( |
386 | 416 |
'used_fields' => array('locality', 'administrative_area', 'postal_code'), |
drupal7/sites/all/modules/addressfield/addressfield.administrative_areas.inc | ||
---|---|---|
14 | 14 |
$administrative_areas = array(); |
15 | 15 |
$administrative_areas['AE'] = array( |
16 | 16 |
'AZ' => t('Abu Dhabi'), |
17 |
'AJ' => t('Ajmān'), |
|
18 | 17 |
'FU' => t('Fujairah'), |
18 |
'UQ' => t('Umm al-Quwain'), |
|
19 | 19 |
'SH' => t('Sharjah'), |
20 | 20 |
'DU' => t('Dubai'), |
21 | 21 |
'RK' => t('Ras al-Khaimah'), |
22 |
'UQ' => t('Umm al-Quwain'),
|
|
22 |
'AJ' => t('Ajmān'),
|
|
23 | 23 |
); |
24 | 24 |
$administrative_areas['AR'] = array( |
25 | 25 |
'B' => t('Buenos Aires'), |
... | ... | |
188 | 188 |
'VAU' => t('Vaupés'), |
189 | 189 |
'VID' => t('Vichada'), |
190 | 190 |
); |
191 |
$administrative_areas['EE'] = array( |
|
192 |
'37' => t('Harjumaa'), |
|
193 |
'39' => t('Hiiumaa'), |
|
194 |
'44' => t('Ida-Virumaa'), |
|
195 |
'49' => t('Jõgevamaa'), |
|
196 |
'51' => t('Järvamaa'), |
|
197 |
'57' => t('Läänemaa'), |
|
198 |
'59' => t('Lääne-Virumaa'), |
|
199 |
'65' => t('Põlvamaa'), |
|
200 |
'67' => t('Pärnumaa'), |
|
201 |
'70' => t('Raplamaa'), |
|
202 |
'74' => t('Saaremaa'), |
|
203 |
'78' => t('Tartumaa'), |
|
204 |
'82' => t('Valgamaa'), |
|
205 |
'84' => t('Viljandimaa'), |
|
206 |
'86' => t('Võrumaa'), |
|
207 |
); |
|
191 | 208 |
$administrative_areas['EG'] = array( |
192 | 209 |
'ALX' => t('Alexandria'), |
193 | 210 |
'ASN' => t('Aswan'), |
... | ... | |
602 | 619 |
'46' => t('Jeollanam-do'), |
603 | 620 |
'50' => t('Sejong'), |
604 | 621 |
); |
622 |
$administrative_areas['KZ'] = array( |
|
623 |
'AST' => t('Astana'), |
|
624 |
'ALA' => t('Almaty'), |
|
625 |
'ALM' => t('Almaty region'), |
|
626 |
'AKM' => t('Aqmola region'), |
|
627 |
'AKT' => t('Aqtöbe region'), |
|
628 |
'ATY' => t('Atyraū region'), |
|
629 |
'ZAP' => t('Batys Qazaqstan region'), |
|
630 |
'MAN' => t('Mangghystaū region'), |
|
631 |
'YUZ' => t('Ongtüstik Qazaqstan region'), |
|
632 |
'PAV' => t('Pavlodar region'), |
|
633 |
'KAR' => t('Qaraghandy region'), |
|
634 |
'KUS' => t('Qostanay region'), |
|
635 |
'KZY' => t('Qyzylorda region'), |
|
636 |
'VOS' => t('Shyghys Qazaqstan region'), |
|
637 |
'SEV' => t('Soltüstik Qazaqstan region'), |
|
638 |
'ZHA' => t('Zhambyl region'), |
|
639 |
); |
|
605 | 640 |
$administrative_areas['MX'] = array( |
606 | 641 |
'AGU' => t('Aguascalientes'), |
607 | 642 |
'BCN' => t('Baja California'), |
... | ... | |
849 | 884 |
'66' => t('Yozgat'), |
850 | 885 |
'67' => t('Zonguldak'), |
851 | 886 |
); |
887 |
$administrative_areas['TW'] = array( |
|
888 |
'TXG' => t('Taichung City'), |
|
889 |
'TPE' => t('Taipei City'), |
|
890 |
'TTT' => t('Taitung County'), |
|
891 |
'TNN' => t('Tainan City'), |
|
892 |
'ILA' => t('Yilan County'), |
|
893 |
'HUA' => t('Hualien County'), |
|
894 |
'Kinmen County' => t('Kinmen County'), |
|
895 |
'NAN' => t('Nantou County'), |
|
896 |
'PIF' => t('Pingtung County'), |
|
897 |
'MIA' => t('Miaoli County'), |
|
898 |
'TAO' => t('Taoyuan County'), |
|
899 |
'KHH' => t('Kaohsiung City'), |
|
900 |
'KEE' => t('Keelung City'), |
|
901 |
'Lienchiang County' => t('Lienchiang County'), |
|
902 |
'YUN' => t('Yunlin County'), |
|
903 |
'TPQ' => t('New Taipei City'), |
|
904 |
'HSZ' => t('Hsinchu City'), |
|
905 |
'HSQ' => t('Hsinchu County'), |
|
906 |
'CYI' => t('Chiayi City'), |
|
907 |
'CYQ' => t('Chiayi County'), |
|
908 |
'CHA' => t('Changhua County'), |
|
909 |
'PEN' => t('Penghu County'), |
|
910 |
); |
|
911 |
$administrative_areas['UA'] = array( |
|
912 |
'43' => t('Crimea'), |
|
913 |
'05' => t('Vinnyts\'ka oblast'), |
|
914 |
'07' => t('Volyns\'ka oblast'), |
|
915 |
'12' => t('Dnipropetrovsk Oblast'), |
|
916 |
'14' => t('Donetsk Oblast'), |
|
917 |
'18' => t('Zhytomyrs\'ka oblast'), |
|
918 |
'21' => t('Zakarpats\'ka oblast'), |
|
919 |
'23' => t('Zaporiz\'ka oblast'), |
|
920 |
'26' => t('Ivano-Frankivs\'ka oblast'), |
|
921 |
'30' => t('Kyiv city'), |
|
922 |
'30' => t('Kiev Oblast'), |
|
923 |
'35' => t('Kirovohrads\'ka oblast'), |
|
924 |
'09' => t('Luhans\'ka oblast'), |
|
925 |
'46' => t('Lviv Oblast'), |
|
926 |
'48' => t('Mykolaivs\'ka oblast'), |
|
927 |
'51' => t('Odessa Oblast'), |
|
928 |
'53' => t('Poltavs\'ka oblast'), |
|
929 |
'56' => t('Rivnens\'ka oblast'), |
|
930 |
'40' => t('Sevastopol\' city'), |
|
931 |
'59' => t('Sums\'ka oblast'), |
|
932 |
'61' => t('Ternopil\'s\'ka oblast'), |
|
933 |
'63' => t('Kharkiv Oblast'), |
|
934 |
'65' => t('Khersons\'ka oblast'), |
|
935 |
'68' => t('Khmel\'nyts\'ka oblast'), |
|
936 |
'71' => t('Cherkas\'ka oblast'), |
|
937 |
'77' => t('Chernivets\'ka oblast'), |
|
938 |
'74' => t('Chernihivs\'ka oblast'), |
|
939 |
); |
|
852 | 940 |
$administrative_areas['US'] = array( |
853 | 941 |
'AL' => t('Alabama'), |
854 | 942 |
'AK' => t('Alaska'), |
drupal7/sites/all/modules/addressfield/addressfield.api.php | ||
---|---|---|
29 | 29 |
// No example. |
30 | 30 |
} |
31 | 31 |
|
32 |
/** |
|
33 |
* Allows modules to alter the default values for an address field. |
|
34 |
* |
|
35 |
* @param $default_values |
|
36 |
* The array of default values. The country is populated from the |
|
37 |
* 'default_country' widget setting. |
|
38 |
* @param $context |
|
39 |
* An array with the following keys: |
|
40 |
* - field: The field array. |
|
41 |
* - instance: The instance array. |
|
42 |
* - address: The current address values. Allows for per-country defaults. |
|
43 |
*/ |
|
44 |
function hook_addressfield_default_values_alter(&$default_values, $context) { |
|
45 |
// If no other default country was provided, set it to France. |
|
46 |
// Note: you might want to check $context['instance']['required'] and |
|
47 |
// skip setting the default country if the field is optional. |
|
48 |
if (empty($default_values['country'])) { |
|
49 |
$default_values['country'] = 'FR'; |
|
50 |
} |
|
51 |
|
|
52 |
// Determine the country for which other defaults should be provided. |
|
53 |
$selected_country = $default_values['country']; |
|
54 |
if (isset($context['address']['country'])) { |
|
55 |
$selected_country = $context['address']['country']; |
|
56 |
} |
|
57 |
|
|
58 |
// Add defaults for the US. |
|
59 |
if ($selected_country == 'US') { |
|
60 |
$default_values['locality'] = 'New York'; |
|
61 |
$default_values['administrative_area'] = 'NY'; |
|
62 |
} |
|
63 |
} |
|
64 |
|
|
32 | 65 |
/** |
33 | 66 |
* Allows modules to alter the predefined address formats. |
34 | 67 |
* |
drupal7/sites/all/modules/addressfield/addressfield.info | ||
---|---|---|
9 | 9 |
files[] = views/addressfield_views_handler_field_country.inc |
10 | 10 |
files[] = views/addressfield_views_handler_filter_country.inc |
11 | 11 |
|
12 |
; Information added by Drupal.org packaging script on 2014-12-15
|
|
13 |
version = "7.x-1.0-rc1"
|
|
12 |
; Information added by Drupal.org packaging script on 2015-01-16
|
|
13 |
version = "7.x-1.0" |
|
14 | 14 |
core = "7.x" |
15 | 15 |
project = "addressfield" |
16 |
datestamp = "1418653688"
|
|
16 |
datestamp = "1421426885"
|
|
17 | 17 |
|
drupal7/sites/all/modules/addressfield/addressfield.install | ||
---|---|---|
184 | 184 |
} |
185 | 185 |
} |
186 | 186 |
} |
187 |
|
|
188 |
/** |
|
189 |
* Sets the value of the new "Default country" setting. |
|
190 |
*/ |
|
191 |
function addressfield_update_7001() { |
|
192 |
$address_fields = array(); |
|
193 |
foreach (field_info_fields() as $field_name => $field_info) { |
|
194 |
if ($field_info['type'] == 'addressfield') { |
|
195 |
$address_fields[$field_name] = $field_name; |
|
196 |
} |
|
197 |
} |
|
198 |
|
|
199 |
foreach (field_info_instances() as $entity_type => $bundles) { |
|
200 |
foreach ($bundles as $bundle_name => $instances) { |
|
201 |
foreach (array_intersect_key($instances, $address_fields) as $field_name => $instance) { |
|
202 |
// Optional fields get the None default. Required fields get the |
|
203 |
// previously selected default country. |
|
204 |
$default_country = ''; |
|
205 |
if (!empty($instance['required']) && !empty($instance['default_value'])) { |
|
206 |
$default_country = $instance['default_value']['country']; |
|
207 |
} |
|
208 |
|
|
209 |
$instance['widget']['settings']['default_country'] = $default_country; |
|
210 |
unset($instance['default_value']); |
|
211 |
|
|
212 |
field_update_instance($instance); |
|
213 |
} |
|
214 |
} |
|
215 |
} |
|
216 |
} |
drupal7/sites/all/modules/addressfield/addressfield.module | ||
---|---|---|
181 | 181 |
ctools_plugin_load_function('addressfield', 'format', $handler, 'format callback'); |
182 | 182 |
} |
183 | 183 |
|
184 |
_addressfield_process_format_form($format, $format['#address'], $format['#required']);
|
|
184 |
_addressfield_process_format_form($format, $format['#address']); |
|
185 | 185 |
return $format; |
186 | 186 |
} |
187 | 187 |
|
188 |
function _addressfield_process_format_form(&$format, $address, $required) {
|
|
188 |
function _addressfield_process_format_form(&$format, $address) { |
|
189 | 189 |
foreach (element_children($format) as $key) { |
190 | 190 |
$child = &$format[$key]; |
191 | 191 |
|
... | ... | |
211 | 211 |
} |
212 | 212 |
} |
213 | 213 |
|
214 |
if (!$required) { |
|
215 |
unset($child['#required']); |
|
216 |
} |
|
217 |
|
|
218 | 214 |
if (isset($address[$key])) { |
219 | 215 |
$child['#default_value'] = $address[$key]; |
220 | 216 |
} |
221 | 217 |
} |
222 | 218 |
|
223 | 219 |
// Recurse through the element's children if it has any. |
224 |
_addressfield_process_format_form($child, $address, $required);
|
|
220 |
_addressfield_process_format_form($child, $address); |
|
225 | 221 |
} |
226 | 222 |
} |
227 | 223 |
|
... | ... | |
365 | 361 |
|
366 | 362 |
/** |
367 | 363 |
* Returns an array of default values for the addressfield form elements. |
368 |
*/ |
|
369 |
function addressfield_default_values($available_countries = NULL) { |
|
370 |
if (!isset($available_countries)) { |
|
371 |
$available_countries = _addressfield_country_options_list(); |
|
372 |
} |
|
373 |
|
|
374 |
// Use the default country of the site if possible. |
|
375 |
$default_country = variable_get('site_default_country', NULL); |
|
376 |
|
|
377 |
// If the default country is undefined or not in the list of available countries, |
|
378 |
// just fallback to the first country in the list. |
|
379 |
if (!$default_country || !isset($available_countries[$default_country])) { |
|
364 |
* |
|
365 |
* @param $field |
|
366 |
* The field array. |
|
367 |
* @param $instance |
|
368 |
* The instance array. |
|
369 |
* @param $address |
|
370 |
* The current address values, if known. Allows for per-country defaults. |
|
371 |
* |
|
372 |
* @return |
|
373 |
* An array of default values. |
|
374 |
*/ |
|
375 |
function addressfield_default_values($field, $instance, array $address = array()) { |
|
376 |
$available_countries = _addressfield_country_options_list($field, $instance); |
|
377 |
$default_country = $instance['widget']['settings']['default_country']; |
|
378 |
// If the default country is not in the list of available countries, |
|
379 |
// fallback to the first country in the list. |
|
380 |
if ($default_country && !isset($available_countries[$default_country])) { |
|
380 | 381 |
$default_country = key($available_countries); |
381 | 382 |
} |
382 | 383 |
|
383 |
return array(
|
|
384 |
$default_values = array(
|
|
384 | 385 |
'country' => $default_country, |
385 | 386 |
'name_line' => '', |
386 | 387 |
'first_name' => '', |
... | ... | |
396 | 397 |
'sub_premise' => '', |
397 | 398 |
'data' => '', |
398 | 399 |
); |
400 |
|
|
401 |
// Allow other modules to alter the default values. |
|
402 |
$context = array( |
|
403 |
'field' => $field, |
|
404 |
'instance' => $instance, |
|
405 |
'address' => $address, |
|
406 |
); |
|
407 |
drupal_alter('addressfield_default_values', $default_values, $context); |
|
408 |
|
|
409 |
return $default_values; |
|
399 | 410 |
} |
400 | 411 |
|
401 | 412 |
/** |
... | ... | |
447 | 458 |
'field types' => array('addressfield'), |
448 | 459 |
'settings' => array( |
449 | 460 |
'available_countries' => array(), |
461 |
'default_country' => '', |
|
450 | 462 |
'format_handlers' => array('address'), |
451 | 463 |
), |
452 | 464 |
); |
... | ... | |
472 | 484 |
'#options' => _addressfield_country_options_list(), |
473 | 485 |
'#default_value' => $settings['available_countries'], |
474 | 486 |
); |
475 |
|
|
487 |
$form['default_country'] = array( |
|
488 |
'#type' => 'select', |
|
489 |
'#title' => t('Default country'), |
|
490 |
'#options' => _addressfield_country_options_list(), |
|
491 |
'#default_value' => $settings['default_country'], |
|
492 |
'#empty_value' => '', |
|
493 |
); |
|
476 | 494 |
$form['format_handlers'] = array( |
477 | 495 |
'#type' => 'checkboxes', |
478 | 496 |
'#title' => t('Format handlers'), |
... | ... | |
484 | 502 |
return $form; |
485 | 503 |
} |
486 | 504 |
|
505 |
/** |
|
506 |
* Implements hook_form_BASE_FORM_ID_alter(). |
|
507 |
* |
|
508 |
* Removes the default values form from the field settings page. |
|
509 |
* Allows the module to implement its own, more predictable default value |
|
510 |
* handling, getting around #1253820 and other bugs. |
|
511 |
*/ |
|
512 |
function addressfield_form_field_ui_field_edit_form_alter(&$form, $form_state) { |
|
513 |
if ($form['#field']['type'] == 'addressfield') { |
|
514 |
$form['instance']['default_value_widget']['#access'] = FALSE; |
|
515 |
} |
|
516 |
} |
|
517 |
|
|
487 | 518 |
/** |
488 | 519 |
* Implements hook_field_widget_form() |
489 | 520 |
*/ |
... | ... | |
512 | 543 |
} |
513 | 544 |
|
514 | 545 |
// Merge in default values. |
515 |
// Skip the country default if the field is optional, in which case it might |
|
516 |
// not have a country selected, causing the whole field to be treated as empty. |
|
517 |
// The same logic applies if the field allows multiple values, in which case |
|
518 |
// only the first delta is required. |
|
519 |
$default_values = addressfield_default_values($countries); |
|
520 |
if (empty($instance['required']) || $delta > 0) { |
|
521 |
$default_values['country'] = ''; |
|
522 |
} |
|
523 |
$address += $default_values; |
|
546 |
$address += addressfield_default_values($field, $instance, $address); |
|
524 | 547 |
|
525 | 548 |
// Add the form elements for the standard widget, which includes a country |
526 | 549 |
// select list at the top that reloads the available address elements when the |
... | ... | |
533 | 556 |
|
534 | 557 |
if (!empty($instance['description'])) { |
535 | 558 |
// Checkout panes convert the fieldset into a container, causing |
536 |
// #description to not be rendered. Hence, a real element is added. |
|
559 |
// #description to not be rendered. Hence, a real element is added and |
|
560 |
// the old #description is removed. |
|
561 |
$element['#description'] = ''; |
|
537 | 562 |
$element['element_description'] = array( |
538 | 563 |
'#markup' => $instance['description'], |
539 | 564 |
'#prefix' => '<div class="fieldset-description">', |
... | ... | |
552 | 577 |
); |
553 | 578 |
$element += addressfield_generate($address, $settings['format_handlers'], $context); |
554 | 579 |
|
555 |
// If #required is set to FALSE, _addressfield_process_format_form() strips |
|
556 |
// it from all child elements. This is only needed on the field edit form. |
|
557 |
$element['#required'] = ($form_state['build_info']['form_id'] != 'field_ui_field_edit_form'); |
|
580 |
// Remove any already saved default value. |
|
581 |
// See addressfield_form_field_ui_field_edit_form_alter() for the reasoning. |
|
582 |
if ($form_state['build_info']['form_id'] == 'field_ui_field_edit_form') { |
|
583 |
$element['#address'] = array('country' => ''); |
|
584 |
} |
|
558 | 585 |
} |
559 | 586 |
|
560 | 587 |
return $element; |
... | ... | |
763 | 790 |
* |
764 | 791 |
* @see addressfield_property_info_callback() |
765 | 792 |
*/ |
766 |
function addressfield_auto_creation() { |
|
767 |
// We can't call addressfield_default_values() directly, because it has an |
|
768 |
// optional array argument that will receive an invalid value when Entity API |
|
769 |
// tries to call it directly with its usual $property_name and $context |
|
770 |
// arguments. |
|
771 |
return addressfield_default_values(); |
|
793 |
function addressfield_auto_creation($property_name, $context) { |
|
794 |
return addressfield_default_values($context['field'], $context['instance']); |
|
772 | 795 |
} |
773 | 796 |
|
774 | 797 |
/** |
... | ... | |
833 | 856 |
} |
834 | 857 |
|
835 | 858 |
/** |
836 |
* Wraps country_get_list() for use as an Entity API options list.
|
|
859 |
* Returns the country list in a format suitable for use as an options list.
|
|
837 | 860 |
*/ |
838 | 861 |
function _addressfield_country_options_list($field = NULL, $instance = NULL) { |
839 |
// Necessary for country_get_list(). |
|
840 |
require_once DRUPAL_ROOT . '/includes/locale.inc'; |
|
841 |
|
|
842 |
$countries = country_get_list(); |
|
862 |
if (module_exists('countries')) { |
|
863 |
$countries = countries_get_countries('name', array('enabled' => COUNTRIES_ENABLED)); |
|
864 |
} |
|
865 |
else { |
|
866 |
require_once DRUPAL_ROOT . '/includes/locale.inc'; |
|
867 |
$countries = country_get_list(); |
|
868 |
} |
|
843 | 869 |
|
844 | 870 |
if (isset($field)) { |
845 | 871 |
// If the instance is not specified, loop against all the instances of the field. |
... | ... | |
858 | 884 |
foreach ($instances as $instance) { |
859 | 885 |
if (!empty($instance['widget']['settings']['available_countries'])) { |
860 | 886 |
$countries = array_intersect_key($countries, $instance['widget']['settings']['available_countries']); |
861 |
} |
|
862 |
else { |
|
863 |
// This instance allow all the countries. |
|
864 |
$countries = country_get_list(); |
|
865 | 887 |
break; |
866 | 888 |
} |
867 | 889 |
} |
drupal7/sites/all/modules/addressfield/example/addressfield_example.info | ||
---|---|---|
7 | 7 |
dependencies[] = ctools |
8 | 8 |
dependencies[] = addressfield |
9 | 9 |
|
10 |
; Information added by Drupal.org packaging script on 2014-12-15
|
|
11 |
version = "7.x-1.0-rc1"
|
|
10 |
; Information added by Drupal.org packaging script on 2015-01-16
|
|
11 |
version = "7.x-1.0" |
|
12 | 12 |
core = "7.x" |
13 | 13 |
project = "addressfield" |
14 |
datestamp = "1418653688"
|
|
14 |
datestamp = "1421426885"
|
|
15 | 15 |
|
drupal7/sites/all/modules/addressfield/plugins/format/address-optional.inc | ||
---|---|---|
1 |
<?php |
|
2 |
|
|
3 |
/** |
|
4 |
* @file |
|
5 |
* Make all fields optional. |
|
6 |
* Allows users to save incomplete addresses, bypassing validation. |
|
7 |
*/ |
|
8 |
|
|
9 |
$plugin = array( |
|
10 |
'title' => t('Make all fields optional (Not recommended)'), |
|
11 |
'format callback' => 'addressfield_format_address_optional', |
|
12 |
'type' => 'address', |
|
13 |
'weight' => 100, |
|
14 |
); |
|
15 |
|
|
16 |
/** |
|
17 |
* Format callback. |
|
18 |
* |
|
19 |
* @see CALLBACK_addressfield_format_callback() |
|
20 |
*/ |
|
21 |
function addressfield_format_address_optional(&$format, $address, $context = array()) { |
|
22 |
if (isset($format['name_block'])) { |
|
23 |
if (isset($format['name_block']['name_line'])) { |
|
24 |
$format['name_block']['name_line']['#required'] = FALSE; |
|
25 |
} |
|
26 |
elseif (isset($format['name_block']['first_name'])) { |
|
27 |
$format['name_block']['first_name']['#required'] = FALSE; |
|
28 |
$format['name_block']['last_name']['#required'] = FALSE; |
|
29 |
} |
|
30 |
} |
|
31 |
$format['street_block']['thoroughfare']['#required'] = FALSE; |
|
32 |
$format['locality_block']['postal_code']['#required'] = FALSE; |
|
33 |
$format['locality_block']['dependent_locality']['#required'] = FALSE; |
|
34 |
$format['locality_block']['locality']['#required'] = FALSE; |
|
35 |
$format['locality_block']['administrative_area']['#required'] = FALSE; |
|
36 |
} |
drupal7/sites/all/modules/addressfield/plugins/format/address.inc | ||
---|---|---|
104 | 104 |
'#empty_value' => '', |
105 | 105 |
'#size' => 10, |
106 | 106 |
'#prefix' => ' ', |
107 |
'#render_option_value' => $address_format['render_administrative_area_value'], |
|
107 | 108 |
'#attributes' => array( |
108 | 109 |
'class' => array('state'), |
109 | 110 |
'x-autocompletetype' => 'region', |
... | ... | |
138 | 139 |
} |
139 | 140 |
|
140 | 141 |
// Country-specific customizations. |
141 |
if (in_array($address['country'], array('AU', 'NZ', 'RU'))) { |
|
142 |
if (in_array($address['country'], array('AU', 'EE', 'LT', 'LV', 'NZ', 'RU'))) {
|
|
142 | 143 |
// These countries don't use the "Address 2" line. |
143 | 144 |
// Leave it as a precaution, but hide the label to avoid confusing users. |
144 | 145 |
$format['street_block']['thoroughfare']['#title'] = t('Address'); |
... | ... | |
152 | 153 |
elseif ($address['country'] == 'BR') { |
153 | 154 |
$format['locality_block']['dependent_locality']['#suffix'] = $clearfix; |
154 | 155 |
$format['locality_block']['dependent_locality']['#tag'] = 'div'; |
155 |
$format['locality_block']['administrative_area']['#render_option_value'] = TRUE; |
|
156 | 156 |
$format['locality_block']['administrative_area']['#suffix'] = $clearfix; |
157 | 157 |
$format['locality_block']['postal_code']['#tag'] = 'div'; |
158 | 158 |
// Change some titles to make translation easier. |
... | ... | |
188 | 188 |
$format['locality_block']['administrative_area']['#size'] = '30'; |
189 | 189 |
} |
190 | 190 |
elseif ($address['country'] == 'ID') { |
191 |
$format['locality_block']['administrative_area']['#render_option_value'] = TRUE; |
|
192 | 191 |
$format['locality_block']['administrative_area']['#weight'] = 1; |
193 | 192 |
} |
194 | 193 |
elseif ($address['country'] == 'JP') { |
... | ... | |
198 | 197 |
$format['locality_block']['postal_code']['#size'] = 30; |
199 | 198 |
$format['locality_block']['administrative_area']['#weight'] = 20; |
200 | 199 |
$format['locality_block']['administrative_area']['#size'] = 30; |
201 |
$format['locality_block']['administrative_area']['#render_option_value'] = TRUE; |
|
202 | 200 |
$format['locality_block']['locality']['#weight'] = 30; |
203 | 201 |
$format['street_block']['#weight'] = 20; |
204 | 202 |
} |
drupal7/sites/all/modules/addressfield/views/addressfield.views.inc | ||
---|---|---|
28 | 28 |
'country' => 'addressfield_views_handler_field_country', |
29 | 29 |
'administrative_area' => 'views_handler_field', |
30 | 30 |
'sub_administrative_area' => 'views_handler_field', |
31 |
'dependent_locality' => 'views_handler_field', |
|
31 | 32 |
'locality' => 'views_handler_field', |
32 | 33 |
'postal_code' => 'views_handler_field', |
33 | 34 |
'thoroughfare' => 'views_handler_field', |
drupal7/sites/all/modules/commerce/commerce.info | ||
---|---|---|
12 | 12 |
; Central Entity Controller. |
13 | 13 |
files[] = includes/commerce.controller.inc |
14 | 14 |
|
15 |
; Information added by Drupal.org packaging script on 2014-09-10
|
|
16 |
version = "7.x-1.10"
|
|
15 |
; Information added by Drupal.org packaging script on 2015-01-16
|
|
16 |
version = "7.x-1.11"
|
|
17 | 17 |
core = "7.x" |
18 | 18 |
project = "commerce" |
19 |
datestamp = "1410366834"
|
|
19 |
datestamp = "1421426596"
|
|
20 | 20 |
|
drupal7/sites/all/modules/commerce/commerce_ui.info | ||
---|---|---|
4 | 4 |
dependencies[] = commerce |
5 | 5 |
core = 7.x |
6 | 6 |
|
7 |
; Information added by Drupal.org packaging script on 2014-09-10
|
|
8 |
version = "7.x-1.10"
|
|
7 |
; Information added by Drupal.org packaging script on 2015-01-16
|
|
8 |
version = "7.x-1.11"
|
|
9 | 9 |
core = "7.x" |
10 | 10 |
project = "commerce" |
11 |
datestamp = "1410366834"
|
|
11 |
datestamp = "1421426596"
|
|
12 | 12 |
|
drupal7/sites/all/modules/commerce/includes/commerce.currency.inc | ||
---|---|---|
239 | 239 |
'name' => t('Swiss Franc'), |
240 | 240 |
'rounding_step' => '0.05', |
241 | 241 |
'numeric_code' => '756', |
242 |
'thousands_separator' => "'", |
|
242 | 243 |
'minor_unit' => t('Rappen'), |
243 | 244 |
'major_unit' => t('Franc'), |
244 | 245 |
), |
... | ... | |
552 | 553 |
), |
553 | 554 |
'IRR' => array( |
554 | 555 |
'code' => 'IRR', |
555 |
'symbol' => '﷼',
|
|
556 |
'symbol' => 'ریال',
|
|
556 | 557 |
'name' => t('Iranian Rial'), |
558 |
'decimals' => 0, |
|
557 | 559 |
'numeric_code' => '364', |
558 | 560 |
'symbol_placement' => 'after', |
559 | 561 |
'code_placement' => 'hidden', |
drupal7/sites/all/modules/commerce/modules/cart/commerce_cart.info | ||
---|---|---|
21 | 21 |
; Simple tests |
22 | 22 |
files[] = tests/commerce_cart.test |
23 | 23 |
|
24 |
; Information added by Drupal.org packaging script on 2014-09-10
|
|
25 |
version = "7.x-1.10"
|
|
24 |
; Information added by Drupal.org packaging script on 2015-01-16
|
|
25 |
version = "7.x-1.11"
|
|
26 | 26 |
core = "7.x" |
27 | 27 |
project = "commerce" |
28 |
datestamp = "1410366834"
|
|
28 |
datestamp = "1421426596"
|
|
29 | 29 |
|
drupal7/sites/all/modules/commerce/modules/cart/commerce_cart.module | ||
---|---|---|
363 | 363 |
$form['cart_refresh'] = array( |
364 | 364 |
'#type' => 'fieldset', |
365 | 365 |
'#title' => t('Shopping cart refresh'), |
366 |
'#description' => t('Shopping cart orders comprise orders in shopping cart and some checkout related order statuses. These settings let you control the shopping cart orders are refreshed, the process during which product prices are recalculated, to improve site performance in the case of excessive refreshes on sites with less dynamic pricing needs.'), |
|
366 |
'#description' => t('Shopping cart orders comprise orders in shopping cart and some checkout related order statuses. These settings let you control how the shopping cart orders are refreshed, the process during which product prices are recalculated, to improve site performance in the case of excessive refreshes on sites with less dynamic pricing needs.'),
|
|
367 | 367 |
'#weight' => 40, |
368 | 368 |
); |
369 | 369 |
$form['cart_refresh']['commerce_cart_refresh_mode'] = array( |
... | ... | |
2236 | 2236 |
// form with form IDs based on the $product_ids. |
2237 | 2237 |
$form['#validate'][] = 'commerce_cart_add_to_cart_form_validate'; |
2238 | 2238 |
$form['#submit'][] = 'commerce_cart_add_to_cart_form_submit'; |
2239 |
$form['#after_build'][] = 'commerce_cart_add_to_cart_form_after_build'; |
|
2239 | 2240 |
|
2240 | 2241 |
return $form; |
2241 | 2242 |
} |
... | ... | |
2287 | 2288 |
// Then render and return the various product fields that might need to be |
2288 | 2289 |
// updated on the page. |
2289 | 2290 |
if (!empty($form_state['context'])) { |
2290 |
$product = $form_state['default_product']; |
|
2291 |
$product = commerce_product_load($form_state['default_product_id']); |
|
2292 |
$form_state['default_product'] = $product; |
|
2291 | 2293 |
$product->display_context = $form_state['context']; |
2292 | 2294 |
|
2293 | 2295 |
// First render the actual fields attached to the referenced product. |
... | ... | |
2423 | 2425 |
} |
2424 | 2426 |
} |
2425 | 2427 |
|
2428 |
/** |
|
2429 |
* After build callback for the Add to Cart form. |
|
2430 |
*/ |
|
2431 |
function commerce_cart_add_to_cart_form_after_build(&$form, &$form_state) { |
|
2432 |
// Remove the default_product entity to mitigate cache_form bloat and performance issues. |
|
2433 |
if (isset($form_state['default_product'])) { |
|
2434 |
$form_state['default_product_id'] = $form_state['default_product']->product_id; |
|
2435 |
unset($form_state['default_product']); |
|
2436 |
} |
|
2437 |
return $form; |
|
2438 |
} |
|
2439 |
|
|
2426 | 2440 |
/** |
2427 | 2441 |
* Implements hook_field_info_alter(). |
2428 | 2442 |
*/ |
drupal7/sites/all/modules/commerce/modules/checkout/commerce_checkout.info | ||
---|---|---|
12 | 12 |
; Simple tests |
13 | 13 |
files[] = tests/commerce_checkout.test |
14 | 14 |
|
15 |
; Information added by Drupal.org packaging script on 2014-09-10
|
|
16 |
version = "7.x-1.10"
|
|
15 |
; Information added by Drupal.org packaging script on 2015-01-16
|
|
16 |
version = "7.x-1.11"
|
|
17 | 17 |
core = "7.x" |
18 | 18 |
project = "commerce" |
19 |
datestamp = "1410366834"
|
|
19 |
datestamp = "1421426596"
|
|
20 | 20 |
|
drupal7/sites/all/modules/commerce/modules/checkout/commerce_checkout.module | ||
---|---|---|
593 | 593 |
foreach ($conditions as $property => $value) { |
594 | 594 |
// If the current value for the specified property on the pane does not |
595 | 595 |
// match the filter value... |
596 |
if ($checkout_pane[$property] != $value) { |
|
596 |
if (!isset($checkout_pane[$property]) || $checkout_pane[$property] != $value) {
|
|
597 | 597 |
// Do not add it to the temporary array. |
598 | 598 |
$valid = FALSE; |
599 | 599 |
} |
drupal7/sites/all/modules/commerce/modules/checkout/includes/commerce_checkout.admin.inc | ||
---|---|---|
15 | 15 |
$checkout_pages = commerce_checkout_pages(); |
16 | 16 |
|
17 | 17 |
// Add a "disabled" pseudo-page. |
18 |
$checkout_pages['disabled'] = array('page_id' => 'disabled', 'title' => t('Disabled'));
|
|
18 |
$checkout_pages['disabled'] = array('page_id' => 'disabled', 'name' => t('Disabled'));
|
|
19 | 19 |
|
20 | 20 |
$form['checkout_pages'] = array( |
21 | 21 |
'#type' => 'value', |
... | ... | |
29 | 29 |
$form['page'][$page_id]['panes'] = array('#tree' => TRUE); |
30 | 30 |
|
31 | 31 |
// Build the options list for selecting the pane's checkout page. |
32 |
$checkout_pages_options[$page_id] = $checkout_pages[$page_id]['title'];
|
|
32 |
$checkout_pages_options[$page_id] = $checkout_pages[$page_id]['name'];
|
|
33 | 33 |
} |
34 | 34 |
|
35 | 35 |
// Loop through all the checkout panes on the site. |
... | ... | |
114 | 114 |
drupal_set_message(t('%pane must be configured before it can be enabled. It has been moved back to a disabled position.', array('%pane' => $panes[$pane_id]['title'])), 'warning'); |
115 | 115 |
} |
116 | 116 |
else { |
117 |
drupal_set_message(t('%pane is locked in the code to the %page page and was repositioned accordingly.', array('%pane' => $panes[$pane_id]['title'], '%page' => $pages[$panes[$pane_id]['page']]['title'])), 'warning');
|
|
117 |
drupal_set_message(t('%pane is locked in the code to the %page page and was repositioned accordingly.', array('%pane' => $panes[$pane_id]['title'], '%page' => $pages[$panes[$pane_id]['page']]['name'])), 'warning');
|
|
118 | 118 |
} |
119 | 119 |
|
120 | 120 |
form_set_value($element, $panes[$pane_id]['page'], $form_state); |
... | ... | |
181 | 181 |
|
182 | 182 |
// Add a non-draggable header row for each checkout page. |
183 | 183 |
$row = array( |
184 |
array('data' => $checkout_page['title'], 'colspan' => 4),
|
|
184 |
array('data' => $checkout_page['name'], 'colspan' => 4),
|
|
185 | 185 |
); |
186 | 186 |
|
187 | 187 |
$rows[] = array('data' => $row, 'class' => array('page-header')); |
drupal7/sites/all/modules/commerce/modules/checkout/includes/commerce_checkout.pages.inc | ||
---|---|---|
67 | 67 |
function commerce_checkout_form($form, &$form_state, $order, $checkout_page) { |
68 | 68 |
global $user; |
69 | 69 |
|
70 |
// Ensure this include file is loaded when the form is rebuilt from the cache. |
|
71 |
$form_state['build_info']['files']['form'] = drupal_get_path('module', 'commerce_checkout') . '/includes/commerce_checkout.pages.inc'; |
|
72 |
|
|
70 | 73 |
$form['#attached']['css'][] = drupal_get_path('module', 'commerce_checkout') .'/theme/commerce_checkout.base.css'; |
71 | 74 |
$form['#attached']['css'][] = drupal_get_path('module', 'commerce_checkout') .'/theme/commerce_checkout.theme.css'; |
72 | 75 |
$form['#attached']['js'][] = drupal_get_path('module', 'commerce_checkout') . '/commerce_checkout.js'; |
drupal7/sites/all/modules/commerce/modules/customer/commerce_customer.info | ||
---|---|---|
21 | 21 |
; Simple tests |
22 | 22 |
; files[] = tests/commerce_customer.test |
23 | 23 |
|
24 |
; Information added by Drupal.org packaging script on 2014-09-10
|
|
25 |
version = "7.x-1.10"
|
|
24 |
; Information added by Drupal.org packaging script on 2015-01-16
|
|
25 |
version = "7.x-1.11"
|
|
26 | 26 |
core = "7.x" |
27 | 27 |
project = "commerce" |
28 |
datestamp = "1410366834"
|
|
28 |
datestamp = "1421426596"
|
|
29 | 29 |
|
drupal7/sites/all/modules/commerce/modules/customer/commerce_customer.module | ||
---|---|---|
1052 | 1052 |
$key = 0; |
1053 | 1053 |
|
1054 | 1054 |
foreach ($profiles as $profile) { |
1055 |
// Add a fieldset around the profile form. |
|
1056 | 1055 |
$element['profiles'][$key] = array( |
1057 | 1056 |
'#type' => 'fieldset', |
1058 | 1057 |
'#title' => check_plain($profile_type['name']), |
1058 |
'#parents' => array_merge($element['#field_parents'], array($element['#field_name'], $langcode, 'profiles', $key)), |
|
1059 | 1059 |
); |
1060 | 1060 |
|
1061 | 1061 |
// Store the original customer profile for later comparison. |
drupal7/sites/all/modules/commerce/modules/customer/commerce_customer_ui.info | ||
---|---|---|
12 | 12 |
; Simple tests |
13 | 13 |
files[] = tests/commerce_customer_ui.test |
14 | 14 |
|
15 |
; Information added by Drupal.org packaging script on 2014-09-10
|
|
16 |
version = "7.x-1.10"
|
|
15 |
; Information added by Drupal.org packaging script on 2015-01-16
|
|
16 |
version = "7.x-1.11"
|
|
17 | 17 |
core = "7.x" |
18 | 18 |
project = "commerce" |
19 |
datestamp = "1410366834"
|
|
19 |
datestamp = "1421426596"
|
|
20 | 20 |
|
drupal7/sites/all/modules/commerce/modules/customer/tests/commerce_customer_profile_dummy_type.info | ||
---|---|---|
5 | 5 |
core = 7.x |
6 | 6 |
hidden = TRUE |
7 | 7 |
|
8 |
; Information added by Drupal.org packaging script on 2014-09-10
|
|
9 |
version = "7.x-1.10"
|
|
8 |
; Information added by Drupal.org packaging script on 2015-01-16
|
|
9 |
version = "7.x-1.11"
|
|
10 | 10 |
core = "7.x" |
11 | 11 |
project = "commerce" |
12 |
datestamp = "1410366834"
|
|
12 |
datestamp = "1421426596"
|
|
13 | 13 |
|
drupal7/sites/all/modules/commerce/modules/line_item/commerce_line_item.info | ||
---|---|---|
22 | 22 |
; Simple tests |
23 | 23 |
; files[] = tests/commerce_line_item.test |
24 | 24 |
|
25 |
; Information added by Drupal.org packaging script on 2014-09-10
|
|
26 |
version = "7.x-1.10"
|
|
25 |
; Information added by Drupal.org packaging script on 2015-01-16
|
|
26 |
version = "7.x-1.11"
|
|
27 | 27 |
core = "7.x" |
28 | 28 |
project = "commerce" |
29 |
datestamp = "1410366834"
|
|
29 |
datestamp = "1421426596"
|
|
30 | 30 |
|
drupal7/sites/all/modules/commerce/modules/line_item/commerce_line_item.info.inc | ||
---|---|---|
81 | 81 |
'schema field' => 'changed', |
82 | 82 |
); |
83 | 83 |
|
84 |
$info['commerce_line_item']['bundles'] = array(); |
|
85 |
foreach (commerce_line_item_type_get_name() as $type => $name) { |
|
86 |
$info['commerce_line_item']['bundles'][$type] = array( |
|
87 |
'label' => $name, |
|
88 |
); |
|
89 |
} |
|
90 |
|
|
84 | 91 |
return $info; |
85 | 92 |
} |
86 | 93 |
|
... | ... | |
88 | 95 |
* Implements hook_entity_property_info_alter() on top of the Line Item module. |
89 | 96 |
*/ |
90 | 97 |
function commerce_line_item_entity_property_info_alter(&$info) { |
91 |
if (!empty($info['commerce_line_item']['bundles'])) { |
|
92 |
// Move the price properties to the line item by default; as they are required |
|
93 |
// default fields, this makes dealing with them more convenient. |
|
94 |
$properties = array(); |
|
98 |
// Move the price properties to the line item by default; as they are required |
|
99 |
// default fields, this makes dealing with them more convenient. |
|
100 |
$properties = array(); |
|
95 | 101 |
|
96 |
foreach ($info['commerce_line_item']['bundles'] as $bundle => $bundle_info) {
|
|
97 |
$bundle_info += array('properties' => array());
|
|
98 |
$properties += $bundle_info['properties'];
|
|
99 |
}
|
|
102 |
foreach ($info['commerce_line_item']['bundles'] as $bundle => $bundle_info) { |
|
103 |
$bundle_info += array('properties' => array()); |
|
104 |
$properties += $bundle_info['properties']; |
|
105 |
} |
|
100 | 106 |
|
107 |
if (!empty($properties['commerce_unit_price'])) { |
|
101 | 108 |
$info['commerce_line_item']['properties']['commerce_unit_price'] = $properties['commerce_unit_price']; |
109 |
} |
|
110 |
if (!empty($properties['commerce_total'])) { |
|
102 | 111 |
$info['commerce_line_item']['properties']['commerce_total'] = $properties['commerce_total']; |
103 | 112 |
} |
104 | 113 |
} |
drupal7/sites/all/modules/commerce/modules/line_item/commerce_line_item.module | ||
---|---|---|
48 | 48 |
), |
49 | 49 |
); |
50 | 50 |
|
51 |
$return['commerce_line_item']['bundles'] = array(); |
|
51 | 52 |
foreach (commerce_line_item_type_get_name() as $type => $name) { |
52 | 53 |
$return['commerce_line_item']['bundles'][$type] = array( |
53 | 54 |
'label' => $name, |
... | ... | |
499 | 500 |
// Otherwise turn the array values into the type name only. |
500 | 501 |
$line_item_type_names = array(); |
501 | 502 |
|
502 |
foreach ((array) $line_item_types as $key => $value) {
|
|
503 |
foreach ($line_item_types as $key => $value) { |
|
503 | 504 |
$line_item_type_names[$key] = $value['name']; |
504 | 505 |
} |
505 | 506 |
|
drupal7/sites/all/modules/commerce/modules/line_item/commerce_line_item_ui.info | ||
---|---|---|
9 | 9 |
core = 7.x |
10 | 10 |
configure = admin/commerce/config/line-items |
11 | 11 |
|
12 |
; Information added by Drupal.org packaging script on 2014-09-10
|
|
13 |
version = "7.x-1.10"
|
|
12 |
; Information added by Drupal.org packaging script on 2015-01-16
|
|
13 |
version = "7.x-1.11"
|
|
14 | 14 |
core = "7.x" |
15 | 15 |
project = "commerce" |
16 |
datestamp = "1410366834"
|
|
16 |
datestamp = "1421426596"
|
|
17 | 17 |
|
drupal7/sites/all/modules/commerce/modules/order/commerce_order.info | ||
---|---|---|
36 | 36 |
files[] = tests/commerce_order.rules.test |
37 | 37 |
files[] = tests/commerce_order.test |
38 | 38 |
|
39 |
; Information added by Drupal.org packaging script on 2014-09-10
|
|
40 |
version = "7.x-1.10"
|
|
39 |
; Information added by Drupal.org packaging script on 2015-01-16
|
|
40 |
version = "7.x-1.11"
|
|
41 | 41 |
core = "7.x" |
42 | 42 |
project = "commerce" |
43 |
datestamp = "1410366834"
|
|
43 |
datestamp = "1421426596"
|
|
44 | 44 |
|
drupal7/sites/all/modules/commerce/modules/order/commerce_order.info.inc | ||
---|---|---|
129 | 129 |
$properties += $bundle_info['properties']; |
130 | 130 |
} |
131 | 131 |
|
132 |
$info['commerce_order']['properties']['commerce_line_items'] = $properties['commerce_line_items']; |
|
133 |
$info['commerce_order']['properties']['commerce_order_total'] = $properties['commerce_order_total']; |
|
132 |
if (!empty($properties['commerce_line_items'])) { |
|
133 |
$info['commerce_order']['properties']['commerce_line_items'] = $properties['commerce_line_items']; |
|
134 |
} |
|
135 |
if (!empty($properties['commerce_order_total'])) { |
|
136 |
$info['commerce_order']['properties']['commerce_order_total'] = $properties['commerce_order_total']; |
|
137 |
} |
|
134 | 138 |
} |
drupal7/sites/all/modules/commerce/modules/order/commerce_order_ui.info | ||
---|---|---|
16 | 16 |
; Simple tests |
17 | 17 |
files[] = tests/commerce_order_ui.test |
18 | 18 |
|
19 |
; Information added by Drupal.org packaging script on 2014-09-10
|
|
20 |
version = "7.x-1.10"
|
|
19 |
; Information added by Drupal.org packaging script on 2015-01-16
|
|
20 |
version = "7.x-1.11"
|
|
21 | 21 |
core = "7.x" |
22 | 22 |
project = "commerce" |
23 |
datestamp = "1410366834"
|
|
23 |
datestamp = "1421426596"
|
|
24 | 24 |
|
drupal7/sites/all/modules/commerce/modules/payment/commerce_payment.api.php | ||
---|---|---|
270 | 270 |
* redirect are handled by the Payment module, so these two operations should |
271 | 271 |
* not be duplicated by the payment method module. |
272 | 272 |
*/ |
273 |
function CALLBACK_commerce_payment_method_redirect_form_back($form, &$form_state, $order, $payment_method) {
|
|
273 |
function CALLBACK_commerce_payment_method_redirect_form_back($order, $payment_method) { |
|
274 | 274 |
// No example. |
275 | 275 |
} |
276 | 276 |
|
... | ... | |
385 | 385 |
* total. If the balance is less than or equal to zero, it is considered paid in |
386 | 386 |
* full. The first time an order's balance falls to or below zero, this hook is |
387 | 387 |
* invoked to allow modules to perform special maintenance as necessary. This |
388 |
* hook is invoked after the "When an order is first paid in full" Rules event.
|
|
388 |
* hook is invoked before the "When an order is first paid in full" Rules event.
|
|
389 | 389 |
* |
390 | 390 |
* Through the administration of payment transactions, it is possible for an |
391 | 391 |
* order's balance to go above zero. It is then possible for the balance to go |
drupal7/sites/all/modules/commerce/modules/payment/commerce_payment.info | ||
---|---|---|
30 | 30 |
files[] = tests/commerce_payment.rules.test |
31 | 31 |
;files[] = tests/commerce_payment.test |
32 | 32 |
|
33 |
; Information added by Drupal.org packaging script on 2014-09-10
|
|
34 |
version = "7.x-1.10"
|
|
33 |
; Information added by Drupal.org packaging script on 2015-01-16
|
|
34 |
version = "7.x-1.11"
|
|
35 | 35 |
core = "7.x" |
36 | 36 |
project = "commerce" |
37 |
datestamp = "1410366834"
|
|
37 |
datestamp = "1421426596"
|
|
38 | 38 |
|
drupal7/sites/all/modules/commerce/modules/payment/commerce_payment.module | ||
---|---|---|
796 | 796 |
*/ |
797 | 797 |
function theme_commerce_payment_transaction_status_icon($variables) { |
798 | 798 |
$transaction_status = $variables['transaction_status']; |
799 |
return theme('image', array('path' => $transaction_status['icon'], 'alt' => $transaction_status['title'], 'title' => $transaction_status['title'], 'attributes' => array('class' => drupal_html_class($transaction_status['status']))));
|
|
799 |
return theme('image', array('path' => $transaction_status['icon'], 'alt' => $transaction_status['title'], 'title' => $transaction_status['title'], 'attributes' => array('class' => array(drupal_html_class($transaction_status['status'])))));
|
|
800 | 800 |
} |
801 | 801 |
|
802 | 802 |
/** |
drupal7/sites/all/modules/commerce/modules/payment/commerce_payment.rules.inc | ||
---|---|---|
180 | 180 |
); |
181 | 181 |
} |
182 | 182 |
|
183 |
$actions['commerce_payment_redirect_pane_previous_page'] = array( |
|
184 |
'label' => t('Redirect the checkout to the previous pane'), |
|
185 |
'parameter' => array( |
|
186 |
'commerce_order' => array( |
|
187 |
'type' => 'commerce_order', |
|
188 |
'label' => t('Order', array(), array( |
|
189 |
'context' => 'a drupal commerce order', |
|
190 |
)), |
|
191 |
'skip save' => TRUE, |
|
192 |
), |
|
193 |
), |
|
194 |
'group' => t('Commerce Payment'), |
|
195 |
'callbacks' => array( |
|
196 |
'execute' => 'commerce_payment_rules_redirect_pane_previous_page', |
|
197 |
), |
|
198 |
); |
|
199 |
$actions['commerce_payment_redirect_pane_next_page'] = array( |
|
200 |
'label' => t('Redirect the checkout to the next pane'), |
|
201 |
'parameter' => array( |
|
202 |
'commerce_order' => array( |
|
203 |
'type' => 'commerce_order', |
|
204 |
'label' => t('Order', array(), array( |
|
205 |
'context' => 'a drupal commerce order', |
|
206 |
)), |
|
207 |
'skip save' => TRUE, |
|
208 |
), |
|
209 |
), |
|
210 |
'group' => t('Commerce Payment'), |
|
211 |
'callbacks' => array( |
|
212 |
'execute' => 'commerce_payment_rules_redirect_pane_next_page', |
|
213 |
), |
|
214 |
); |
|
215 |
|
|
183 | 216 |
return $actions; |
184 | 217 |
} |
185 | 218 |
|
219 |
/** |
|
220 |
* Implements Rules action execution callback. |
|
221 |
* |
|
222 |
* @param stdClass $order |
|
223 |
* An order. |
|
224 |
*/ |
|
225 |
function commerce_payment_rules_redirect_pane_previous_page($order) { |
|
226 |
commerce_payment_redirect_pane_previous_page($order); |
|
227 |
} |
|
228 |
|
|
229 |
/** |
|
230 |
* Implements Rules action execution callback. |
|
231 |
* |
|
232 |
* @param stdClass $order |
|
233 |
* An order. |
|
234 |
*/ |
|
235 |
function commerce_payment_rules_redirect_pane_next_page($order) { |
|
236 |
commerce_payment_redirect_pane_next_page($order); |
|
237 |
} |
|
238 |
|
|
186 | 239 |
/** |
187 | 240 |
* Generic execution callback for the payment method. |
188 | 241 |
*/ |
drupal7/sites/all/modules/commerce/modules/payment/commerce_payment_ui.info | ||
---|---|---|
12 | 12 |
; Simple tests |
13 | 13 |
files[] = tests/commerce_payment_ui.test |
14 | 14 |
|
15 |
; Information added by Drupal.org packaging script on 2014-09-10
|
|
16 |
version = "7.x-1.10"
|
|
15 |
; Information added by Drupal.org packaging script on 2015-01-16
|
|
16 |
version = "7.x-1.11"
|
|
17 | 17 |
core = "7.x" |
18 | 18 |
project = "commerce" |
19 |
datestamp = "1410366834"
|
|
19 |
datestamp = "1421426596"
|
|
20 | 20 |
|
drupal7/sites/all/modules/commerce/modules/payment/modules/commerce_payment_example.info | ||
---|---|---|
5 | 5 |
dependencies[] = commerce_payment |
6 | 6 |
core = 7.x |
7 | 7 |
|
8 |
; Information added by Drupal.org packaging script on 2014-09-10
|
|
9 |
version = "7.x-1.10"
|
|
8 |
; Information added by Drupal.org packaging script on 2015-01-16
|
|
9 |
version = "7.x-1.11"
|
|
10 | 10 |
core = "7.x" |
11 | 11 |
project = "commerce" |
12 |
datestamp = "1410366834"
|
|
12 |
datestamp = "1421426596"
|
|
13 | 13 |
|
drupal7/sites/all/modules/commerce/modules/payment/tests/commerce_payment_dummy_offsite.info | ||
---|---|---|
5 | 5 |
core = 7.x |
6 | 6 |
hidden = TRUE |
7 | 7 |
|
8 |
; Information added by Drupal.org packaging script on 2014-09-10
|
|
9 |
version = "7.x-1.10"
|
|
8 |
; Information added by Drupal.org packaging script on 2015-01-16
|
|
9 |
version = "7.x-1.11"
|
|
10 | 10 |
core = "7.x" |
11 | 11 |
project = "commerce" |
12 |
datestamp = "1410366834"
|
|
12 |
datestamp = "1421426596"
|
|
13 | 13 |
|
drupal7/sites/all/modules/commerce/modules/price/commerce_price.info | ||
---|---|---|
11 | 11 |
files[] = includes/views/handlers/commerce_price_handler_field_commerce_price.inc |
12 | 12 |
files[] = includes/views/handlers/commerce_price_handler_filter_commerce_price_amount.inc |
13 | 13 |
|
14 |
; Information added by Drupal.org packaging script on 2014-09-10
|
|
15 |
version = "7.x-1.10"
|
|
14 |
; Information added by Drupal.org packaging script on 2015-01-16
|
|
15 |
version = "7.x-1.11"
|
|
16 | 16 |
core = "7.x" |
17 | 17 |
project = "commerce" |
18 |
datestamp = "1410366834"
|
|
18 |
datestamp = "1421426596"
|
|
19 | 19 |
|
drupal7/sites/all/modules/commerce/modules/product/commerce_product.info | ||
---|---|---|
25 | 25 |
; Simple tests |
26 | 26 |
files[] = tests/commerce_product.test |
27 | 27 |
|
28 |
; Information added by Drupal.org packaging script on 2014-09-10
|
|
29 |
version = "7.x-1.10"
|
|
28 |
; Information added by Drupal.org packaging script on 2015-01-16
|
|
29 |
version = "7.x-1.11"
|
|
30 | 30 |
core = "7.x" |
31 | 31 |
project = "commerce" |
32 |
datestamp = "1410366834"
|
|
32 |
datestamp = "1421426596"
|
|
33 | 33 |
|
drupal7/sites/all/modules/commerce/modules/product/commerce_product.info.inc | ||
---|---|---|
102 | 102 |
'clear' => array('uid'), |
103 | 103 |
); |
104 | 104 |
|
105 |
$info['commerce_product']['bundles'] = array(); |
|
106 |
foreach (commerce_product_type_get_name() as $type => $name) { |
|
107 |
$info['commerce_product']['bundles'][$type] = array( |
|
108 |
'label' => $name, |
|
109 |
); |
|
110 |
} |
|
111 |
|
|
105 | 112 |
return $info; |
106 | 113 |
} |
107 | 114 |
|
... | ... | |
109 | 116 |
* Implements hook_entity_property_info_alter() on top of the Product module. |
110 | 117 |
*/ |
111 | 118 |
function commerce_product_entity_property_info_alter(&$info) { |
112 |
if (!empty($info['commerce_product']['bundles'])) { |
|
113 |
// Move the default price property to the product by default; as it is a |
|
114 |
// required default field, this makes dealing with it more convenient. |
|
115 |
$properties = array(); |
|
119 |
// Move the default price property to the product by default; as it is a |
|
120 |
// required default field, this makes dealing with it more convenient. |
|
121 |
$properties = array(); |
|
116 | 122 |
|
117 |
foreach ($info['commerce_product']['bundles'] as $bundle => $bundle_info) {
|
|
118 |
$bundle_info += array('properties' => array());
|
|
119 |
$properties += $bundle_info['properties'];
|
|
120 |
}
|
|
123 |
foreach ($info['commerce_product']['bundles'] as $bundle => $bundle_info) { |
|
124 |
$bundle_info += array('properties' => array()); |
|
125 |
$properties += $bundle_info['properties']; |
|
126 |
} |
|
121 | 127 |
|
122 |
if (!empty($properties['commerce_price'])) { |
|
123 |
$info['commerce_product']['properties']['commerce_price'] = $properties['commerce_price']; |
|
124 |
} |
|
128 |
if (!empty($properties['commerce_price'])) { |
|
129 |
$info['commerce_product']['properties']['commerce_price'] = $properties['commerce_price']; |
|
125 | 130 |
} |
126 | 131 |
} |
drupal7/sites/all/modules/commerce/modules/product/commerce_product.module | ||
---|---|---|
150 | 150 |
), |
151 | 151 |
); |
152 | 152 |
|
153 |
$return['commerce_product']['bundles'] = array(); |
|
153 | 154 |
foreach (commerce_product_type_get_name() as $type => $name) { |
154 | 155 |
$return['commerce_product']['bundles'][$type] = array( |
155 | 156 |
'label' => $name, |
... | ... | |
206 | 207 |
* Implements hook_field_extra_fields(). |
207 | 208 |
*/ |
208 | 209 |
function commerce_product_field_extra_fields() { |
209 |
$extra = array(); |
|
210 |
|
|
211 |
foreach (commerce_product_types() as $type => $product_type) { |
|
212 |
$extra['commerce_product'][$type] = array( |
|
213 |
'form' => array( |
|
214 |
'sku' => array( |
|
215 |
'label' => t('Product SKU'), |
|
216 |
'description' => t('Product module SKU form element'), |
|
217 |
'weight' => -10, |
|
218 |
), |
|
219 |
'title' => array( |
|
220 |
'label' => t('Title'), |
|
221 |
'description' => t('Product module title form element'), |
|
222 |
'weight' => -5, |
|
223 |
), |
|
224 |
'status' => array( |
|
225 |
'label' => t('Status'), |
|
226 |
'description' => t('Product module status form element'), |
|
227 |
'weight' => 35, |
|
228 |
), |
|
229 |
), |
|
230 |
'display' => array( |
|
231 |
'sku' => array( |
|
232 |
'label' => t('SKU'), |
|
233 |
'description' => t('The human readable identifier of the product'), |
|
234 |
'theme' => 'commerce_product_sku', |
|
235 |
'weight' => -10, |
|
236 |
), |
|
237 |
'title' => array( |
|
238 |
'label' => t('Title'), |
|
239 |
'description' => t('Full product title'), |
|
240 |
'theme' => 'commerce_product_title', |
|
241 |
'weight' => -5, |
|
210 |
$extra = &drupal_static(__FUNCTION__); |
|
211 |
|
|
212 |
if (!isset($extra)) { |
|
213 |
foreach (commerce_product_types() as $type => $product_type) { |
|
214 |
$extra['commerce_product'][$type] = array( |
|
215 |
'form' => array( |
|
216 |
'sku' => array( |
|
217 |
'label' => t('Product SKU'), |
|
218 |
'description' => t('Product module SKU form element'), |
|
219 |
'weight' => -10, |
|
220 |
), |
|
221 |
'title' => array( |
|
222 |
'label' => t('Title'), |
|
223 |
'description' => t('Product module title form element'), |
|
224 |
'weight' => -5, |
|
225 |
), |
|
226 |
'status' => array( |
|
227 |
'label' => t('Status'), |
|
228 |
'description' => t('Product module status form element'), |
|
229 |
'weight' => 35, |
|
230 |
), |
|
242 | 231 |
), |
243 |
'status' => array( |
|
244 |
'label' => t('Status'), |
|
245 |
'description' => t('Whether the product is active or disabled'), |
|
246 |
'theme' => 'commerce_product_status', |
|
247 |
'weight' => 5, |
|
232 |
'display' => array( |
|
233 |
'sku' => array( |
|
234 |
'label' => t('SKU'), |
|
235 |
'description' => t('The human readable identifier of the product'), |
|
236 |
'theme' => 'commerce_product_sku', |
|
237 |
'weight' => -10, |
|
238 |
), |
|
239 |
'title' => array( |
|
240 |
'label' => t('Title'), |
|
241 |
'description' => t('Full product title'), |
|
242 |
'theme' => 'commerce_product_title', |
|
243 |
'weight' => -5, |
|
244 |
), |
|
245 |
'status' => array( |
Formats disponibles : Unified diff
Weekly update of contrib modules