function commerce_customer_profile_type_get_name in Commerce Core 7
Returns the human readable name of any or all customer profile types.
Parameters
$type: Optional parameter specifying the type whose name to return.
Return value
Either an array of all profile type names keyed by the machine name or a string containing the human readable name for the specified type. If a type is specified that does not exist, this function returns FALSE.
6 calls to commerce_customer_profile_type_get_name()
- commerce_customer_entity_info in modules/
customer/ commerce_customer.module - Implements hook_entity_info().
- commerce_customer_field_settings_form in modules/
customer/ commerce_customer.module - Implements hook_field_settings_form().
- commerce_customer_handler_field_customer_profile_type::render in modules/
customer/ includes/ views/ handlers/ commerce_customer_handler_field_customer_profile_type.inc - Render the field.
- commerce_customer_options_list in modules/
customer/ commerce_customer.module - Implements hook_options_list().
- commerce_customer_profile_type_options_list in modules/
customer/ commerce_customer.module - Wraps commerce_customer_profile_type_get_name() for the Entity module.
File
- modules/
customer/ commerce_customer.module, line 529 - Defines the customer profile entity and API functions to manage customers and interact with them.
Code
function commerce_customer_profile_type_get_name($type = NULL) {
$profile_types = commerce_customer_profile_types();
// Return a type name if specified and it exists.
if (!empty($type)) {
if (isset($profile_types[$type])) {
return $profile_types[$type]['name'];
}
else {
// Return FALSE if it does not exist.
return FALSE;
}
}
// Otherwise turn the array values into the type name only.
foreach ($profile_types as $key => $value) {
$profile_types[$key] = $value['name'];
}
return $profile_types;
}