You are here

function uc_addresses_user_address_property_get in Ubercart Addresses 7

Entity API getter callback for a default address of an user.

Parameters

object $account: The account to get a default address for.

array $options: An array of options, passed by Entity API, but ignored in this implementation.

string $name: The address to get.

Return value

UcAddressesAddress An instance of UcAddressesAddress, if found. NULL otherwise.

1 string reference to 'uc_addresses_user_address_property_get'
uc_addresses_entity_property_info_alter in ./uc_addresses.module
Implements hook_entity_property_info_alter().

File

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

Code

function uc_addresses_user_address_property_get($account, $options, $name) {
  switch ($name) {
    case 'uc_addresses_default_shipping_address':
      return UcAddressesAddressBook::get($account->uid)
        ->getDefaultAddress('shipping');
    case 'uc_addresses_default_billing_address':
      return UcAddressesAddressBook::get($account->uid)
        ->getDefaultAddress('billing');
  }
  return NULL;
}