You are here

function uc_order_address_property_get in Ubercart 7.3

Entity metadata callback: get the delivery or billing address of an order.

1 string reference to 'uc_order_address_property_get'
uc_order_entity_property_info in uc_order/uc_order.info.inc
Implements hook_entity_property_info().

File

uc_order/uc_order.module, line 2234

Code

function uc_order_address_property_get($order, array $options, $name, $entity_type) {
  switch ($name) {
    case 'delivery_address':
      $type = 'delivery_';
      break;
    case 'billing_address':
      $type = 'billing_';
      break;
    default:
      return NULL;
  }
  $address = new UcAddress();
  foreach ($address as $field => $value) {
    if ($field != 'email') {
      $address->{$field} = $order->{$type . $field};
    }
  }
  return $address;
}