Révision fbb05e21
Ajouté par Assos Assos il y a environ 9 ans
drupal7/sites/all/modules/addressfield/addressfield.address_formats.inc | ||
---|---|---|
42 | 42 |
$countries_with_optional_postal_code = array( |
43 | 43 |
'AC', 'AD', 'AL', 'AZ', 'BA', 'BB', 'BD', 'BG', 'BH', 'BM', 'BN', 'BT', |
44 | 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',
|
|
45 |
'GW', 'HR', 'HT', 'IL', 'IS', 'JO', 'KE', 'KG', 'KH', 'KW', 'LA', |
|
46 | 46 |
'LA', 'LB', 'LK', 'LR', 'LS', 'MA', 'MC', 'MD', 'ME', 'MG', 'MK', 'MM', |
47 | 47 |
'MT', 'MU', 'MV', 'NE', 'NP', 'OM', 'PK', 'PY', 'RO', 'RS', 'SA', 'SI', |
48 | 48 |
'SK', 'SN', 'SZ', 'TA', 'TJ', 'TM', 'TN', 'VA', 'VC', 'VG', 'XK', 'ZM', |
... | ... | |
57 | 57 |
// postal code in 'used_fields' and 'required_fields'. |
58 | 58 |
$countries_with_required_postal_code = array( |
59 | 59 |
'AT', 'AX', 'BE', 'BL', 'CH', 'DE', 'DK', 'FI', 'FK', 'FR', 'GF', 'GG', |
60 |
'GL', 'GP', 'GR', 'GS', 'IM', 'IO', 'JE', 'LI', 'LU', 'MF', 'MQ', 'NC', |
|
60 |
'GL', 'GP', 'GR', 'GS', 'HU', 'IM', 'IO', 'JE', 'LI', 'LU', 'MF', 'MQ', 'NC',
|
|
61 | 61 |
'NL', 'NO', 'PL', 'PM', 'PN', 'PT', 'RE', 'SE', 'SH', 'SJ', 'TC', 'WF', |
62 | 62 |
'YT', |
63 | 63 |
); |
... | ... | |
245 | 245 |
'used_fields' => array('locality', 'administrative_area', 'postal_code'), |
246 | 246 |
'required_fields' => array('locality', 'administrative_area', 'postal_code'), |
247 | 247 |
'administrative_area_label' => t('Region', array(), array('context' => 'Territory of a country')), |
248 |
'render_administrative_area_value' => TRUE, |
|
248 | 249 |
); |
249 | 250 |
$address_formats['LT'] = array( |
250 | 251 |
'used_fields' => array('locality', 'administrative_area', 'postal_code'), |
... | ... | |
343 | 344 |
$address_formats['RU'] = array( |
344 | 345 |
'used_fields' => array('locality', 'administrative_area', 'postal_code'), |
345 | 346 |
'required_fields' => array('locality', 'postal_code'), |
347 |
'render_administrative_area_value' => TRUE, |
|
346 | 348 |
); |
347 | 349 |
$address_formats['SC'] = array( |
348 | 350 |
'used_fields' => array('locality', 'administrative_area'), |
drupal7/sites/all/modules/addressfield/addressfield.devel_generate.inc | ||
---|---|---|
23 | 23 |
*/ |
24 | 24 |
function _addressfield_devel_generate($object, $field, $instance, $bundle) { |
25 | 25 |
// Set default value |
26 |
$object_field = addressfield_default_values(); |
|
26 |
$object_field = addressfield_default_values($field, $instance);
|
|
27 | 27 |
$addresses = _addressfield_sample_addresses(); |
28 | 28 |
$object_field = array_merge($object_field, $addresses[array_rand($addresses)]); |
29 | 29 |
unset($object_field['data']); |
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 2015-01-16
|
|
13 |
version = "7.x-1.0"
|
|
12 |
; Information added by Drupal.org packaging script on 2015-04-23
|
|
13 |
version = "7.x-1.1"
|
|
14 | 14 |
core = "7.x" |
15 | 15 |
project = "addressfield" |
16 |
datestamp = "1421426885"
|
|
16 |
datestamp = "1429819382"
|
|
17 | 17 |
|
drupal7/sites/all/modules/addressfield/addressfield.install | ||
---|---|---|
203 | 203 |
// previously selected default country. |
204 | 204 |
$default_country = ''; |
205 | 205 |
if (!empty($instance['required']) && !empty($instance['default_value'])) { |
206 |
$default_country = $instance['default_value']['country']; |
|
206 |
$default_country = $instance['default_value'][0]['country'];
|
|
207 | 207 |
} |
208 | 208 |
|
209 | 209 |
$instance['widget']['settings']['default_country'] = $default_country; |
drupal7/sites/all/modules/addressfield/addressfield.module | ||
---|---|---|
298 | 298 |
function theme_addressfield_container($variables) { |
299 | 299 |
$element = $variables['element']; |
300 | 300 |
$element['#children'] = trim($element['#children']); |
301 |
// Remove the autocomplete attributes because the W3C validator complains.
|
|
302 |
// They are only used on forms anyway.
|
|
301 |
// Remove the autocomplete attribute because the W3C validator complains. |
|
302 |
// It's only used on forms anyway.
|
|
303 | 303 |
unset($element['#attributes']['autocomplete']); |
304 |
unset($element['#attributes']['x-autocompletetype']); |
|
305 | 304 |
|
306 | 305 |
if (strlen($element['#children']) > 0) { |
307 | 306 |
$output = '<' . $element['#tag'] . drupal_attributes($element['#attributes']) . '>'; |
... | ... | |
375 | 374 |
function addressfield_default_values($field, $instance, array $address = array()) { |
376 | 375 |
$available_countries = _addressfield_country_options_list($field, $instance); |
377 | 376 |
$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])) { |
|
377 |
// Resolve the special site_default option. |
|
378 |
if ($default_country == 'site_default') { |
|
379 |
$default_country = variable_get('site_default_country', ''); |
|
380 |
} |
|
381 |
// Fallback to the first country in the list if the default country is not |
|
382 |
// available, or is empty even though the field is required. |
|
383 |
$not_available = $default_country && !isset($available_countries[$default_country]); |
|
384 |
$empty_but_required = empty($default_country) && !empty($instance['required']); |
|
385 |
if ($not_available || $empty_but_required) { |
|
381 | 386 |
$default_country = key($available_countries); |
382 | 387 |
} |
383 | 388 |
|
... | ... | |
458 | 463 |
'field types' => array('addressfield'), |
459 | 464 |
'settings' => array( |
460 | 465 |
'available_countries' => array(), |
461 |
'default_country' => '', |
|
466 |
// Can't use variable_get('site_default_country') here because it would |
|
467 |
// set the value in stone. Instead, the site_default option allows the |
|
468 |
// default country to always reflect the current site setting. |
|
469 |
'default_country' => 'site_default', |
|
462 | 470 |
'format_handlers' => array('address'), |
463 | 471 |
), |
464 | 472 |
); |
... | ... | |
487 | 495 |
$form['default_country'] = array( |
488 | 496 |
'#type' => 'select', |
489 | 497 |
'#title' => t('Default country'), |
490 |
'#options' => _addressfield_country_options_list(), |
|
498 |
'#options' => array('site_default' => t('- Site default -')) + _addressfield_country_options_list(),
|
|
491 | 499 |
'#default_value' => $settings['default_country'], |
492 | 500 |
'#empty_value' => '', |
493 | 501 |
); |
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 2015-01-16
|
|
11 |
version = "7.x-1.0"
|
|
10 |
; Information added by Drupal.org packaging script on 2015-04-23
|
|
11 |
version = "7.x-1.1"
|
|
12 | 12 |
core = "7.x" |
13 | 13 |
project = "addressfield" |
14 |
datestamp = "1421426885"
|
|
14 |
datestamp = "1429819382"
|
|
15 | 15 |
|
drupal7/sites/all/modules/addressfield/plugins/format/address.inc | ||
---|---|---|
38 | 38 |
'#tag' => 'div', |
39 | 39 |
'#attributes' => array( |
40 | 40 |
'class' => array('thoroughfare'), |
41 |
'x-autocompletetype' => 'address-line1', |
|
42 | 41 |
'autocomplete' => 'address-line1', |
43 | 42 |
), |
44 | 43 |
'#size' => 30, |
44 |
'#maxlength' => 255, |
|
45 | 45 |
'#required' => TRUE, |
46 | 46 |
); |
47 | 47 |
$format['street_block']['premise'] = array( |
... | ... | |
49 | 49 |
'#tag' => 'div', |
50 | 50 |
'#attributes' => array( |
51 | 51 |
'class' => array('premise'), |
52 |
'x-autocompletetype' => 'address-line2', |
|
53 | 52 |
'autocomplete' => 'address-line2', |
54 | 53 |
), |
55 | 54 |
'#size' => 30, |
55 |
'#maxlength' => 255, |
|
56 | 56 |
); |
57 | 57 |
$format['locality_block'] = array( |
58 | 58 |
'#type' => 'addressfield_container', |
... | ... | |
60 | 60 |
'class' => array('addressfield-container-inline', 'locality-block', 'country-' . $address['country']), |
61 | 61 |
), |
62 | 62 |
'#weight' => 50, |
63 |
'#maxlength' => 255, |
|
63 | 64 |
); |
64 | 65 |
$format['locality_block']['#attached']['css'][] = drupal_get_path('module', 'addressfield') . '/addressfield.css'; |
65 | 66 |
$format['locality_block']['postal_code'] = array( |
... | ... | |
67 | 68 |
'#required' => in_array('postal_code', $address_format['required_fields']), |
68 | 69 |
'#access' => in_array('postal_code', $address_format['used_fields']), |
69 | 70 |
'#size' => 10, |
71 |
'#maxlength' => 255, |
|
70 | 72 |
'#attributes' => array( |
71 | 73 |
'class' => array('postal-code'), |
72 |
'x-autocompletetype' => 'postal-code', |
|
73 | 74 |
'autocomplete' => 'postal-code', |
74 | 75 |
), |
75 | 76 |
); |
... | ... | |
78 | 79 |
'#required' => in_array('dependent_locality', $address_format['required_fields']), |
79 | 80 |
'#access' => in_array('dependent_locality', $address_format['used_fields']), |
80 | 81 |
'#size' => 25, |
82 |
'#maxlength' => 255, |
|
81 | 83 |
'#tag' => 'div', |
82 | 84 |
'#attributes' => array( |
83 |
'class' => array('dependent-locality') |
|
85 |
'class' => array('dependent-locality'), |
|
86 |
'autocomplete' => '"address-level3', |
|
84 | 87 |
), |
85 | 88 |
// Most formats place this field in its own row. |
86 | 89 |
'#suffix' => $clearfix, |
... | ... | |
90 | 93 |
'#required' => in_array('locality', $address_format['required_fields']), |
91 | 94 |
'#access' => in_array('locality', $address_format['used_fields']), |
92 | 95 |
'#size' => 30, |
96 |
'#maxlength' => 255, |
|
93 | 97 |
'#prefix' => ' ', |
94 | 98 |
'#attributes' => array( |
95 | 99 |
'class' => array('locality'), |
96 |
'x-autocompletetype' => 'locality', |
|
97 |
'autocomplete' => 'locality', |
|
100 |
'autocomplete' => '"address-level2', |
|
98 | 101 |
), |
99 | 102 |
); |
100 | 103 |
$format['locality_block']['administrative_area'] = array( |
... | ... | |
103 | 106 |
'#access' => in_array('administrative_area', $address_format['used_fields']), |
104 | 107 |
'#empty_value' => '', |
105 | 108 |
'#size' => 10, |
109 |
'#maxlength' => 255, |
|
106 | 110 |
'#prefix' => ' ', |
107 | 111 |
'#render_option_value' => $address_format['render_administrative_area_value'], |
108 | 112 |
'#attributes' => array( |
109 | 113 |
'class' => array('state'), |
110 |
'x-autocompletetype' => 'region', |
|
111 |
'autocomplete' => 'region', |
|
114 |
'autocomplete' => 'address-level1', |
|
112 | 115 |
), |
113 | 116 |
); |
114 | 117 |
$format['country'] = array( |
... | ... | |
118 | 121 |
'#required' => TRUE, |
119 | 122 |
'#attributes' => array( |
120 | 123 |
'class' => array('country'), |
121 |
'x-autocompletetype' => 'country', |
|
122 | 124 |
'autocomplete' => 'country', |
123 | 125 |
), |
124 | 126 |
'#weight' => 100, |
... | ... | |
166 | 168 |
'#tag' => NULL, |
167 | 169 |
'#attributes' => array('class' => array('premise')), |
168 | 170 |
'#size' => 20, |
171 |
'#maxlength' => 255, |
|
169 | 172 |
'#prefix' => ', ', |
170 | 173 |
); |
171 | 174 |
$format['locality_block']['locality']['#suffix'] = ' - '; |
drupal7/sites/all/modules/addressfield/plugins/format/name-full.inc | ||
---|---|---|
28 | 28 |
// until one is selected. |
29 | 29 |
'#access' => !empty($address['country']), |
30 | 30 |
); |
31 |
// Maxlength is set to 127 so that the name_line still can be created without |
|
32 |
// exceeding the char limit from the database. |
|
31 | 33 |
$format['name_block']['first_name'] = array( |
32 | 34 |
'#title' => t('First name'), |
33 | 35 |
'#size' => 30, |
36 |
'#maxlength' => 127, |
|
34 | 37 |
'#required' => TRUE, |
35 | 38 |
'#attributes' => array( |
36 | 39 |
'class' => array('first-name'), |
37 |
'x-autocompletetype' => 'given-name', |
|
38 | 40 |
'autocomplete' => 'given-name', |
39 | 41 |
), |
40 | 42 |
); |
41 | 43 |
$format['name_block']['last_name'] = array( |
42 | 44 |
'#title' => t('Last name'), |
43 | 45 |
'#size' => 30, |
46 |
'#maxlength' => 127, |
|
44 | 47 |
'#required' => TRUE, |
45 | 48 |
'#prefix' => ' ', |
46 | 49 |
'#attributes' => array( |
47 | 50 |
'class' => array('last-name'), |
48 |
'x-autocompletetype' => 'family-name', |
|
49 | 51 |
'autocomplete' => 'family-name', |
50 | 52 |
), |
51 | 53 |
); |
drupal7/sites/all/modules/addressfield/plugins/format/name-oneline.inc | ||
---|---|---|
31 | 31 |
'#tag' => 'div', |
32 | 32 |
'#attributes' => array( |
33 | 33 |
'class' => array('name-block'), |
34 |
'x-autocompletetype' => 'name', |
|
35 | 34 |
'autocomplete' => 'name', |
36 | 35 |
), |
37 | 36 |
'#size' => 30, |
37 |
'#maxlength' => 255, |
|
38 | 38 |
'#required' => TRUE, |
39 | 39 |
); |
40 | 40 |
} |
drupal7/sites/all/modules/addressfield/plugins/format/organisation.inc | ||
---|---|---|
29 | 29 |
$format['organisation_block']['organisation_name'] = array( |
30 | 30 |
'#title' => t('Company'), |
31 | 31 |
'#size' => 30, |
32 |
'#maxlength' => 255, |
|
32 | 33 |
'#attributes' => array( |
33 | 34 |
'class' => array('organisation-name'), |
34 |
'x-autocompletetype' => 'organization', |
|
35 | 35 |
'autocomplete' => 'organization', |
36 | 36 |
), |
37 | 37 |
); |
Formats disponibles : Unified diff
Weekly update of contrib modules