i need to modify users payment and shipping address format to enable user select a city via drop list, so i installed Address Field Estonian format handler, it works perfect before last drupal core update 7.38, now it shows 500 internal server error.
When i reviewed dblog report i found this warning:
Warning: array_combine() [function.array-combine]: Both parameters should have at least 1 element in addressfield_format_address_et_generate() (line 49 of .../sites/all/modules/addressfield_egypt/plugins/format/addressfield-estonia.inc)
code is
/** * @file * A specific handler for CH. */
$plugin = array( 'title' => t('Addressfield optimized for Estonia'), 'format callback' => 'addressfield_format_address_et_generate', 'type' => 'address', 'weight' => -80, );
function addressfield_format_address_et_generate(&$format, $address, $context = array()) { if ($address['country'] == 'EE') { unset($format['street_block']['premise']); $format['street_block']['#attributes']['class'][] = 'addressfield-container-inline'; $format['street_block']['thoroughfare'] = array( '#title' => t('Address'), '#size' => 30, '#required' => TRUE, ); $places = _addressfield_estonia_places(); $counties = array_keys($places); $format['locality_block']['administrative_area'] = array( '#title' => t('County'), '#required' => TRUE, '#prefix' => ' ', '#render_option_value' => TRUE, '#attributes' => array( 'class' => array('administrative_area'), 'x-autocompletetype' => 'administrative_area', 'autocomplete' => 'administrative_area', ), '#weight' => -10, '#empty_value' => '', '#options' => array_combine($counties, $counties), ); $format['street_block']['#weight'] = 80; $format['street_block']['postal_code'] = $format['locality_block']['postal_code']; unset($format['locality_block']['postal_code']); $format['street_block']['postal_code']['#weight'] = 100;
$locality = $address['administrative_area'] ? $places[$address['administrative_area']] : array();
***$format['locality_block']['locality'] = array(***
'#title' => t('City/Parish'),
'#type' => 'select',
'#options' => array_combine($locality, $locality),
'#empty_value' => '',
'#required' => TRUE,
'#render_option_value' => TRUE,
);
if ($context['mode'] == 'render') {
$format['street_block']['postal_code']['#prefix'] = '<br />';
$format['locality_block']['locality']['#suffix'] = '<br />';
$format['locality_block']['administrative_area']['#suffix'] = ', ';
}
if ($context['mode'] == 'form') {
if (!isset($format['#wrapper_id'])) {
$format['#wrapper_id'] = drupal_html_id('addressfield-wrapper');
$format['#prefix'] = '<div id="' . $format['#wrapper_id'] . '">';
$format['#suffix'] = '</div>';
}
// AJAX enable it.
$format['locality_block']['administrative_area']['#ajax'] = array(
'callback' => 'addressfield_standard_widget_refresh',
'wrapper' => $format['#wrapper_id'],
);
}
} }
function _addressfield_estonia_places() { $list = array( 'Harju maakond' => array( 'Keila linn', 'Loksa linn', 'Maardu linn', 'Paldiski linn', 'Saue linn', 'Tallinn', 'Aegviidu vald', 'Anija vald', 'Harku vald', 'Jõelähtme vald', 'Keila vald', 'Kernu vald', 'Kiili vald', 'Kose vald', 'Kuusalu vald', 'Nissi vald', 'Padise vald' , 'Raasiku vald', 'Rae vald', 'Saku vald', 'Saue vald', 'Vasalemma vald', 'Viimsi vald', ),
); return $list; }
Would you please inform me where is problem as i'm not PHP expert?
Thanks in advance for your sincere cooperation.