You are here

function addressfield_field_widget_settings_form in Address Field 7

Implements hook_field_widget_settings_form()

File

./addressfield.module, line 530
Defines a field for attaching country-specific addresses to entities.

Code

function addressfield_field_widget_settings_form($field, $instance) {
  $widget = $instance['widget'];
  $defaults = field_info_widget_settings($widget['type']);
  $settings = array_merge($defaults, $widget['settings']);
  $form = array();
  if ($widget['type'] == 'addressfield_standard') {
    $form['available_countries'] = array(
      '#type' => 'select',
      '#multiple' => TRUE,
      '#title' => t('Available countries'),
      '#description' => t('If no countries are selected, all countries will be available.'),
      '#options' => _addressfield_country_options_list(),
      '#default_value' => $settings['available_countries'],
    );
    $form['default_country'] = array(
      '#type' => 'select',
      '#title' => t('Default country'),
      '#options' => array(
        'site_default' => t('- Site default -'),
      ) + _addressfield_country_options_list(),
      '#default_value' => $settings['default_country'],
      '#empty_value' => '',
    );
    $form['format_handlers'] = array(
      '#type' => 'checkboxes',
      '#title' => t('Format handlers'),
      '#options' => addressfield_format_plugins_options(),
      '#default_value' => $settings['format_handlers'],
    );
  }
  return $form;
}