You are here

function uc_addresses_uc_order_address_property_get in Ubercart Addresses 7

Entity API getter callback for an address attached to the order.

Parameters

object $order: The Ubercart order.

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_uc_order_address_property_get'
uc_addresses_entity_property_info_alter in ./uc_addresses.module
Implements hook_entity_property_info_alter().

File

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

Code

function uc_addresses_uc_order_address_property_get($order, $options, $name) {
  if (!isset($order->uc_addresses)) {

    // Addresses aren't yet attached to the order. Do it now.
    uc_addresses_order_attach_addresses($order);
  }
  switch ($name) {
    case 'uc_addresses_delivery_address':
      return $order->uc_addresses['shipping'];
      break;
    case 'uc_addresses_billing_address':
      return $order->uc_addresses['billing'];
      break;
  }
}