function hook_uc_addresses_select_addresses in Ubercart Addresses 7
Same name and namespace in other branches
- 6.2 uc_addresses.api.php \hook_uc_addresses_select_addresses()
With this hook you can deliver an array of addresses on which the user can select one at checkout or when editing the order, depending on the context $context.
You can return an array of address arrays or an array of UcAddressesAddress instances.
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 An array of address arrays or an array of UcAddressesAddress instances.
1 function implements hook_uc_addresses_select_addresses()
Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.
1 invocation of hook_uc_addresses_select_addresses()
- uc_addresses_get_select_addresses in ./
uc_addresses.module - Returns an array of addresses to be used for the selecting address widget.
File
- ./
uc_addresses.api.php, line 415 - These hooks are invoked by the Ubercart Addresses module. @todo more documentation needed for hook_uc_addresses_field_handlers(). @todo Document the rest of the API.
Code
function hook_uc_addresses_select_addresses($uid, $context, $type) {
// Create and fill an UcAddressesAddress instance.
$address = UcAddressesAddressBook::newAddress();
$address
->setMultipleFields(array(
'first_name' => '',
'last_name' => '',
'phone' => '',
'company' => '',
'street1' => '',
'street2' => '',
'city' => '',
'zone' => 0,
'country' => variable_get('uc_store_country', 840),
'postal_code' => '',
));
// Return an array of address arrays or an array of UcAddressesAddress instances.
return array(
// Example: an UcAddressesAddress instance (created earlier).
$address,
// Example: an address array.
array(
'first_name' => '',
'last_name' => '',
'phone' => '',
'company' => '',
'street1' => '',
'street2' => '',
'city' => '',
'zone' => 0,
'country' => variable_get('uc_store_country', 840),
'postal_code' => '',
),
);
}