diff --git a/plugins/format/address.inc b/plugins/format/address.inc index 6fe37df..ad037fe 100644 --- a/plugins/format/address.inc +++ b/plugins/format/address.inc @@ -273,38 +273,6 @@ function addressfield_format_address_generate(&$format, $address, $context = arr ); $format['locality_block']['administrative_area']['#title'] = t('Province'); } - else if ($address['country'] == 'BR') { - $format['locality_block']['administrative_area']['#options'] = array( - '' => t('--'), - 'AC' => t('Acre'), - 'AL' => t('Alagoas'), - 'AM' => t('Amazonas'), - 'AP' => t('Amapa'), - 'BA' => t('Bahia'), - 'CE' => t('Ceara'), - 'DF' => t('Distrito Federal'), - 'ES' => t('Espirito Santo'), - 'GO' => t('Goias'), - 'MA' => t('Maranhao'), - 'MG' => t('Minas Gerais'), - 'MS' => t('Mato Grosso do Sul'), - 'MT' => t('Mato Grosso'), - 'PA' => t('Para'), - 'PB' => t('Paraiba'), - 'PE' => t('Pernambuco'), - 'PI' => t('Piaui'), - 'PR' => t('Parana'), - 'RJ' => t('Rio de Janeiro'), - 'RN' => t('Rio Grande do Norte'), - 'RO' => t('Rondonia'), - 'RR' => t('Roraima'), - 'RS' => t('Rio Grande do Sul'), - 'SC' => t('Santa Catarina'), - 'SE' => t('Sergipe'), - 'SP' => t('Sao Paulo'), - 'TO' => t('Tocantins'), - ); - } else if ($address['country'] == 'CA') { $format['locality_block']['administrative_area']['#options'] = array( '' => t('--'), @@ -392,6 +360,79 @@ function addressfield_format_address_generate(&$format, $address, $context = arr ); } + // Br-specific tweaks + if ($address['country'] == 'BR') { + + $format['street_block']['thoroughfare'] = array( + '#title' => t('Address'), + '#attributes' => array('class' => array('thoroughfare')), + '#size' => 30, + '#required' => TRUE, + '#suffix' => ', ' + ); + + // hide suffix of street while in form + if ($context['mode'] == 'form') { + $format['street_block']['thoroughfare']['#suffix'] = null; + } + + $format['street_block']['premise'] = array( + '#title' => t('Number'), + '#attributes' => array('class' => array('premise')), + '#size' => 5, + ); + + $format['street_block']['sub_premise'] = array( + '#title' => t('Complement'), + '#attributes' => array('class' => array('sub_premise')), + '#size' => 30, + '#prefix' => ' ' + ); + + $format['locality_block']['administrative_area']['#options'] = array( + '' => t('--'), + 'AC' => t('Acre'), + 'AL' => t('Alagoas'), + 'AM' => t('Amazonas'), + 'AP' => t('Amapa'), + 'BA' => t('Bahia'), + 'CE' => t('Ceara'), + 'DF' => t('Distrito Federal'), + 'ES' => t('Espirito Santo'), + 'GO' => t('Goias'), + 'MA' => t('Maranhao'), + 'MG' => t('Minas Gerais'), + 'MS' => t('Mato Grosso do Sul'), + 'MT' => t('Mato Grosso'), + 'PA' => t('Para'), + 'PB' => t('Paraiba'), + 'PE' => t('Pernambuco'), + 'PI' => t('Piaui'), + 'PR' => t('Parana'), + 'RJ' => t('Rio de Janeiro'), + 'RN' => t('Rio Grande do Norte'), + 'RO' => t('Rondonia'), + 'RR' => t('Roraima'), + 'RS' => t('Rio Grande do Sul'), + 'SC' => t('Santa Catarina'), + 'SE' => t('Sergipe'), + 'SP' => t('Sao Paulo'), + 'TO' => t('Tocantins'), + ); + + $format['locality_block']['postal_code']['#weight'] = 10; + $format['locality_block']['locality']['#weight'] = 30; + $format['locality_block']['administrative_area']['#weight'] = 40; + $format['locality_block']['dependent_locality'] = array( + '#title' => t('Neighborhood'), + '#size' => 10, + '#prefix' => ' ', + '#weight' => 20, + '#attributes' => array('class' => array('neighborhood')), + ); + } + + if ($context['mode'] == 'form') { // Provide a wrapper ID for AJAX replacement based on country selection. if (!isset($format['#wrapper_id'])) {