You are here

function uc_addresses_settings_form in Ubercart Addresses 6.2

Same name and namespace in other branches
  1. 5.2 uc_addresses.module \uc_addresses_settings_form()
  2. 5 uc_addresses.module \uc_addresses_settings_form()
  3. 6 uc_addresses.admin.inc \uc_addresses_settings_form()
  4. 7 uc_addresses.admin.inc \uc_addresses_settings_form()

Module settings form.

Return value

array Form definition.

1 string reference to 'uc_addresses_settings_form'
uc_addresses_menu in ./uc_addresses.module
Implementation of hook_menu().

File

./uc_addresses.admin.inc, line 32
Admin settings for Ubercart Addresses.

Code

function uc_addresses_settings_form() {
  $form['uc_addresses'] = array(
    '#type' => 'fieldset',
    '#title' => t('Ubercart Addresses settings'),
    '#summary callback' => 'summarize_form',
    '#collapsible' => FALSE,
    '#collapsed' => FALSE,
  );
  $form['uc_addresses']['uc_addresses_use_address_name'] = array(
    '#type' => 'checkbox',
    '#title' => t('Use address nicknames'),
    '#description' => t('When checked, users can optionally give an address a name (e.g. "work", "mary", "joe").'),
    '#default_value' => variable_get('uc_addresses_use_address_name', TRUE),
    '#summary callback' => 'summarize_checkbox',
    '#summary arguments' => array(
      t('Users can give addresses a nickname.'),
      t('Users can not give addresses a nickname.'),
    ),
  );
  $form['uc_addresses']['uc_addresses_use_default_billing'] = array(
    '#type' => 'checkbox',
    '#title' => t('Use default billing addresses'),
    '#description' => t('Note that addresses marked as default billing cannot be deleted.'),
    '#default_value' => variable_get('uc_addresses_use_default_billing', TRUE),
    '#summary callback' => 'summarize_checkbox',
    '#summary arguments' => array(
      t('Users can mark an address as default billing.'),
      t('Users can not mark an address as default billing.'),
    ),
  );
  $form['uc_addresses']['uc_addresses_use_default_shipping'] = array(
    '#type' => 'checkbox',
    '#title' => t('Use default shipping addresses'),
    '#description' => t('Note that addresses marked as default shipping cannot be deleted.'),
    '#default_value' => variable_get('uc_addresses_use_default_shipping', TRUE),
    '#summary callback' => 'summarize_checkbox',
    '#summary arguments' => array(
      t('Users can mark an address as default shipping.'),
      t('Users can not mark an address as default shipping.'),
    ),
  );
  $form['checkout'] = array(
    '#type' => 'fieldset',
    '#title' => t('Checkout settings'),
    '#summary callback' => 'summarize_form',
    '#collapsible' => FALSE,
    '#collapsed' => FALSE,
  );
  $form['checkout']['uc_addresses_default_billing_address'] = array(
    '#type' => 'checkbox',
    '#title' => t('Automatically fill in the billing address with the user\'s default billing address.'),
    '#description' => t('Note that %use-default-setting must be activated for this setting to have effect.', array(
      '%use-default-setting' => $form['uc_addresses']['uc_addresses_use_default_billing']['#title'],
    )),
    '#default_value' => variable_get('uc_addresses_default_billing_address', TRUE),
    '#summary callback' => 'summarize_checkbox',
    '#summary arguments' => array(
      t('At checkout the billing address will be automatically filled with the user\'s default billing address.'),
      t('The customer must enter or choose a billing address.'),
    ),
  );
  $form['checkout']['uc_addresses_default_shipping_address'] = array(
    '#type' => 'checkbox',
    '#title' => t('Automatically fill in the delivery address with the user\'s default shipping address.'),
    '#description' => t('Note that %use-default-setting must be activated for this setting to have effect.', array(
      '%use-default-setting' => $form['uc_addresses']['uc_addresses_use_default_shipping']['#title'],
    )),
    '#default_value' => variable_get('uc_addresses_default_shipping_address', TRUE),
    '#summary callback' => 'summarize_checkbox',
    '#summary arguments' => array(
      t('At checkout the delivery address will be automatically filled with the user\'s default shipping address.'),
      t('The customer must enter or choose a delivery address.'),
    ),
  );
  $form['user'] = array(
    '#type' => 'fieldset',
    '#title' => t('User settings'),
    '#summary callback' => 'summarize_form',
    '#collapsible' => FALSE,
    '#collapsed' => FALSE,
  );
  $form['user']['uc_addresses_require_address'] = array(
    '#type' => 'checkbox',
    '#title' => t('Require that an address be entered during registration'),
    '#default_value' => variable_get('uc_addresses_require_address', TRUE),
    '#summary callback' => 'summarize_checkbox',
    '#summary arguments' => array(
      t('The customer must enter an address when registering.'),
      t('The customer does not enter an address when registering.'),
    ),
  );
  $form['user']['uc_addresses_require_address_admin'] = array(
    '#type' => 'checkbox',
    '#title' => t('Require admins to enter an address upon user creation'),
    '#description' => t('When checked, users with the permission %administer-users need to enter an address when they create a new user.', array(
      '%administer-users' => t('administer users'),
    )),
    '#default_value' => variable_get('uc_addresses_require_address_admin', TRUE),
    '#summary callback' => 'summarize_checkbox',
    '#summary arguments' => array(
      t('Admins are required to enter an address when they create a new user.'),
      t("Admins don't have to enter an address when they create a new user."),
    ),
  );
  return system_settings_form($form);
}