updated modules

views friendly_register serial address_field i18n
This commit is contained in:
Bachir Soussi Chiadmi
2015-05-26 19:56:22 +02:00
parent c9f8dc21ed
commit 706c96d663
58 changed files with 584 additions and 367 deletions

View File

@@ -42,7 +42,7 @@ function addressfield_get_address_format($country_code) {
$countries_with_optional_postal_code = array(
'AC', 'AD', 'AL', 'AZ', 'BA', 'BB', 'BD', 'BG', 'BH', 'BM', 'BN', 'BT',
'CR', 'CY', 'CZ', 'DO', 'DZ', 'EC', 'EH', 'ET', 'FO', 'GE', 'GN', 'GT',
'GW', 'HR', 'HT', 'HU', 'IL', 'IS', 'JO', 'KE', 'KG', 'KH', 'KW', 'LA',
'GW', 'HR', 'HT', 'IL', 'IS', 'JO', 'KE', 'KG', 'KH', 'KW', 'LA',
'LA', 'LB', 'LK', 'LR', 'LS', 'MA', 'MC', 'MD', 'ME', 'MG', 'MK', 'MM',
'MT', 'MU', 'MV', 'NE', 'NP', 'OM', 'PK', 'PY', 'RO', 'RS', 'SA', 'SI',
'SK', 'SN', 'SZ', 'TA', 'TJ', 'TM', 'TN', 'VA', 'VC', 'VG', 'XK', 'ZM',
@@ -57,7 +57,7 @@ function addressfield_get_address_format($country_code) {
// postal code in 'used_fields' and 'required_fields'.
$countries_with_required_postal_code = array(
'AT', 'AX', 'BE', 'BL', 'CH', 'DE', 'DK', 'FI', 'FK', 'FR', 'GF', 'GG',
'GL', 'GP', 'GR', 'GS', 'IM', 'IO', 'JE', 'LI', 'LU', 'MF', 'MQ', 'NC',
'GL', 'GP', 'GR', 'GS', 'HU', 'IM', 'IO', 'JE', 'LI', 'LU', 'MF', 'MQ', 'NC',
'NL', 'NO', 'PL', 'PM', 'PN', 'PT', 'RE', 'SE', 'SH', 'SJ', 'TC', 'WF',
'YT',
);
@@ -245,6 +245,7 @@ function addressfield_get_address_format($country_code) {
'used_fields' => array('locality', 'administrative_area', 'postal_code'),
'required_fields' => array('locality', 'administrative_area', 'postal_code'),
'administrative_area_label' => t('Region', array(), array('context' => 'Territory of a country')),
'render_administrative_area_value' => TRUE,
);
$address_formats['LT'] = array(
'used_fields' => array('locality', 'administrative_area', 'postal_code'),
@@ -343,6 +344,7 @@ function addressfield_get_address_format($country_code) {
$address_formats['RU'] = array(
'used_fields' => array('locality', 'administrative_area', 'postal_code'),
'required_fields' => array('locality', 'postal_code'),
'render_administrative_area_value' => TRUE,
);
$address_formats['SC'] = array(
'used_fields' => array('locality', 'administrative_area'),

View File

@@ -23,7 +23,7 @@ function addressfield_devel_generate($object, $field, $instance, $bundle) {
*/
function _addressfield_devel_generate($object, $field, $instance, $bundle) {
// Set default value
$object_field = addressfield_default_values();
$object_field = addressfield_default_values($field, $instance);
$addresses = _addressfield_sample_addresses();
$object_field = array_merge($object_field, $addresses[array_rand($addresses)]);
unset($object_field['data']);

View File

@@ -9,9 +9,9 @@ files[] = addressfield.migrate.inc
files[] = views/addressfield_views_handler_field_country.inc
files[] = views/addressfield_views_handler_filter_country.inc
; Information added by Drupal.org packaging script on 2015-01-16
version = "7.x-1.0"
; Information added by Drupal.org packaging script on 2015-04-23
version = "7.x-1.1"
core = "7.x"
project = "addressfield"
datestamp = "1421426885"
datestamp = "1429819382"

View File

@@ -203,7 +203,7 @@ function addressfield_update_7001() {
// previously selected default country.
$default_country = '';
if (!empty($instance['required']) && !empty($instance['default_value'])) {
$default_country = $instance['default_value']['country'];
$default_country = $instance['default_value'][0]['country'];
}
$instance['widget']['settings']['default_country'] = $default_country;

View File

@@ -298,10 +298,9 @@ function addressfield_theme() {
function theme_addressfield_container($variables) {
$element = $variables['element'];
$element['#children'] = trim($element['#children']);
// Remove the autocomplete attributes because the W3C validator complains.
// They are only used on forms anyway.
// Remove the autocomplete attribute because the W3C validator complains.
// It's only used on forms anyway.
unset($element['#attributes']['autocomplete']);
unset($element['#attributes']['x-autocompletetype']);
if (strlen($element['#children']) > 0) {
$output = '<' . $element['#tag'] . drupal_attributes($element['#attributes']) . '>';
@@ -375,9 +374,15 @@ function addressfield_field_info() {
function addressfield_default_values($field, $instance, array $address = array()) {
$available_countries = _addressfield_country_options_list($field, $instance);
$default_country = $instance['widget']['settings']['default_country'];
// If the default country is not in the list of available countries,
// fallback to the first country in the list.
if ($default_country && !isset($available_countries[$default_country])) {
// Resolve the special site_default option.
if ($default_country == 'site_default') {
$default_country = variable_get('site_default_country', '');
}
// Fallback to the first country in the list if the default country is not
// available, or is empty even though the field is required.
$not_available = $default_country && !isset($available_countries[$default_country]);
$empty_but_required = empty($default_country) && !empty($instance['required']);
if ($not_available || $empty_but_required) {
$default_country = key($available_countries);
}
@@ -458,7 +463,10 @@ function addressfield_field_widget_info() {
'field types' => array('addressfield'),
'settings' => array(
'available_countries' => array(),
'default_country' => '',
// Can't use variable_get('site_default_country') here because it would
// set the value in stone. Instead, the site_default option allows the
// default country to always reflect the current site setting.
'default_country' => 'site_default',
'format_handlers' => array('address'),
),
);
@@ -487,7 +495,7 @@ function addressfield_field_widget_settings_form($field, $instance) {
$form['default_country'] = array(
'#type' => 'select',
'#title' => t('Default country'),
'#options' => _addressfield_country_options_list(),
'#options' => array('site_default' => t('- Site default -')) + _addressfield_country_options_list(),
'#default_value' => $settings['default_country'],
'#empty_value' => '',
);

View File

@@ -7,9 +7,9 @@ hidden = TRUE
dependencies[] = ctools
dependencies[] = addressfield
; Information added by Drupal.org packaging script on 2015-01-16
version = "7.x-1.0"
; Information added by Drupal.org packaging script on 2015-04-23
version = "7.x-1.1"
core = "7.x"
project = "addressfield"
datestamp = "1421426885"
datestamp = "1429819382"

View File

@@ -38,10 +38,10 @@ function addressfield_format_address_generate(&$format, $address, $context = arr
'#tag' => 'div',
'#attributes' => array(
'class' => array('thoroughfare'),
'x-autocompletetype' => 'address-line1',
'autocomplete' => 'address-line1',
),
'#size' => 30,
'#maxlength' => 255,
'#required' => TRUE,
);
$format['street_block']['premise'] = array(
@@ -49,10 +49,10 @@ function addressfield_format_address_generate(&$format, $address, $context = arr
'#tag' => 'div',
'#attributes' => array(
'class' => array('premise'),
'x-autocompletetype' => 'address-line2',
'autocomplete' => 'address-line2',
),
'#size' => 30,
'#maxlength' => 255,
);
$format['locality_block'] = array(
'#type' => 'addressfield_container',
@@ -60,6 +60,7 @@ function addressfield_format_address_generate(&$format, $address, $context = arr
'class' => array('addressfield-container-inline', 'locality-block', 'country-' . $address['country']),
),
'#weight' => 50,
'#maxlength' => 255,
);
$format['locality_block']['#attached']['css'][] = drupal_get_path('module', 'addressfield') . '/addressfield.css';
$format['locality_block']['postal_code'] = array(
@@ -67,9 +68,9 @@ function addressfield_format_address_generate(&$format, $address, $context = arr
'#required' => in_array('postal_code', $address_format['required_fields']),
'#access' => in_array('postal_code', $address_format['used_fields']),
'#size' => 10,
'#maxlength' => 255,
'#attributes' => array(
'class' => array('postal-code'),
'x-autocompletetype' => 'postal-code',
'autocomplete' => 'postal-code',
),
);
@@ -78,9 +79,11 @@ function addressfield_format_address_generate(&$format, $address, $context = arr
'#required' => in_array('dependent_locality', $address_format['required_fields']),
'#access' => in_array('dependent_locality', $address_format['used_fields']),
'#size' => 25,
'#maxlength' => 255,
'#tag' => 'div',
'#attributes' => array(
'class' => array('dependent-locality')
'class' => array('dependent-locality'),
'autocomplete' => '"address-level3',
),
// Most formats place this field in its own row.
'#suffix' => $clearfix,
@@ -90,11 +93,11 @@ function addressfield_format_address_generate(&$format, $address, $context = arr
'#required' => in_array('locality', $address_format['required_fields']),
'#access' => in_array('locality', $address_format['used_fields']),
'#size' => 30,
'#maxlength' => 255,
'#prefix' => ' ',
'#attributes' => array(
'class' => array('locality'),
'x-autocompletetype' => 'locality',
'autocomplete' => 'locality',
'autocomplete' => '"address-level2',
),
);
$format['locality_block']['administrative_area'] = array(
@@ -103,12 +106,12 @@ function addressfield_format_address_generate(&$format, $address, $context = arr
'#access' => in_array('administrative_area', $address_format['used_fields']),
'#empty_value' => '',
'#size' => 10,
'#maxlength' => 255,
'#prefix' => ' ',
'#render_option_value' => $address_format['render_administrative_area_value'],
'#attributes' => array(
'class' => array('state'),
'x-autocompletetype' => 'region',
'autocomplete' => 'region',
'autocomplete' => 'address-level1',
),
);
$format['country'] = array(
@@ -118,7 +121,6 @@ function addressfield_format_address_generate(&$format, $address, $context = arr
'#required' => TRUE,
'#attributes' => array(
'class' => array('country'),
'x-autocompletetype' => 'country',
'autocomplete' => 'country',
),
'#weight' => 100,
@@ -166,6 +168,7 @@ function addressfield_format_address_generate(&$format, $address, $context = arr
'#tag' => NULL,
'#attributes' => array('class' => array('premise')),
'#size' => 20,
'#maxlength' => 255,
'#prefix' => ', ',
);
$format['locality_block']['locality']['#suffix'] = ' - ';

View File

@@ -28,24 +28,26 @@ function addressfield_format_name_full_generate(&$format, $address) {
// until one is selected.
'#access' => !empty($address['country']),
);
// Maxlength is set to 127 so that the name_line still can be created without
// exceeding the char limit from the database.
$format['name_block']['first_name'] = array(
'#title' => t('First name'),
'#size' => 30,
'#maxlength' => 127,
'#required' => TRUE,
'#attributes' => array(
'class' => array('first-name'),
'x-autocompletetype' => 'given-name',
'autocomplete' => 'given-name',
),
);
$format['name_block']['last_name'] = array(
'#title' => t('Last name'),
'#size' => 30,
'#maxlength' => 127,
'#required' => TRUE,
'#prefix' => ' ',
'#attributes' => array(
'class' => array('last-name'),
'x-autocompletetype' => 'family-name',
'autocomplete' => 'family-name',
),
);

View File

@@ -31,10 +31,10 @@ function addressfield_format_name_oneline_generate(&$format, $address) {
'#tag' => 'div',
'#attributes' => array(
'class' => array('name-block'),
'x-autocompletetype' => 'name',
'autocomplete' => 'name',
),
'#size' => 30,
'#maxlength' => 255,
'#required' => TRUE,
);
}

View File

@@ -29,9 +29,9 @@ function addressfield_format_organisation_generate(&$format, $address) {
$format['organisation_block']['organisation_name'] = array(
'#title' => t('Company'),
'#size' => 30,
'#maxlength' => 255,
'#attributes' => array(
'class' => array('organisation-name'),
'x-autocompletetype' => 'organization',
'autocomplete' => 'organization',
),
);