You are here

function uc_addresses_select_addresses in Ubercart Addresses 7

Widget for selecting an address.

Parameters

int $uid: The user ID to select addresses for.

string $context: The context in which the addresses are used:

  • checkout_form
  • order_form

string $type: The type of address to select addresses for (shipping or billing).

Return value

array A select form element for selecting addresses.

3 calls to uc_addresses_select_addresses()
uc_addresses_checkout_pane_address in ./uc_addresses.ubercart.inc
Generic address pane handler.
uc_addresses_form_uc_order_address_book_form_alter in ./uc_addresses.module
Implements hook_form_FORM_ID_alter() for form uc_order_address_book_form().
uc_addresses_order_pane_address in ./uc_addresses.ubercart.inc
Callback for an address order pane.
1 string reference to 'uc_addresses_select_addresses'
uc_addresses_hook_info in ./uc_addresses.module
Implements hook_hook_info().

File

./uc_addresses.module, line 1751
Adds user profile address support to Ubercart.

Code

function uc_addresses_select_addresses($uid, $context = 'default', $type = 'billing') {

  // Get addresses for select.
  $addresses = uc_addresses_get_select_addresses($uid, $context, $type);
  if (count($addresses) < 1) {

    // No addresses found.
    return NULL;
  }
  return array(
    '#type' => 'uc_addresses_address_select',
    '#title' => t('Address book'),
    '#uc_addresses_select_addresses' => $addresses,
  );
}