function commerce_addressbook_get_saved_addresses_options in Commerce Addressbook 7
Get all available addressbook select list options, per customer profile entity bundle.
Parameters
$uid: user ID to retrieve saved addresses for
$entity_type: The entity type to retrieve saved addresses for. @TODO: won't this always be commerce_customer_profile?
$bundle: The bundle name to retrieve saved addresses for, e.g. 'billing', 'shipping, ...
Return value
array A list of all saved entities, in the form entity_id => address label
1 call to commerce_addressbook_get_saved_addresses_options()
File
- ./
commerce_addressbook.module, line 451 - :
Code
function commerce_addressbook_get_saved_addresses_options($uid, $entity_type = "commerce_customer_profile", $bundle) {
$options = array(
0 => t('-- Select a saved address --'),
);
$customer_profiles = commerce_addressbook_get_saved_addresses($uid);
// Now filter, so we only get the addresses for this bundle
if (isset($customer_profiles[$entity_type][$bundle])) {
$options += $customer_profiles[$entity_type][$bundle];
}
return $options;
}