function commerce_customer_match_customer_profiles in Commerce Core 7
Fetches an array of all customer profiles matching the given parameters.
This info is used in various places (allowed values, autocomplete results, input validation...). Some of them only need the profile_ids, others profile_id + titles, others yet profile_id + titles + rendered row (for display in widgets).
The array we return contains all the potentially needed information, and lets calling functions use the parts they actually need.
Parameters
$field: The field description.
$ids: Optional product ids to lookup.
$limit: If non-zero, limit the size of the result set.
Return value
An array of valid profiles in the form: array( profile_id => array( 'uid' => The user ID, 'rendered' => The text to display in widgets (can be HTML) ), ... )
1 call to commerce_customer_match_customer_profiles()
- commerce_customer_options_list in modules/
customer/ commerce_customer.module - Implements hook_options_list().
File
- modules/
customer/ commerce_customer.module, line 1296 - Defines the customer profile entity and API functions to manage customers and interact with them.
Code
function commerce_customer_match_customer_profiles($field, $ids = array(), $limit = NULL) {
$results =& drupal_static(__FUNCTION__, array());
// Create unique id for static cache.
$cid = implode(':', array(
$field['field_name'],
implode('-', $ids),
$limit,
));
if (!isset($results[$cid])) {
$matches = _commerce_customer_match_customer_profiles_standard($field, $ids, $limit);
// Store the results.
$results[$cid] = !empty($matches) ? $matches : array();
}
return $results[$cid];
}