You are here

function commerce_customer_profile_types in Commerce Core 7

Returns an array of customer profile type arrays keyed by type.

13 calls to commerce_customer_profile_types()
CommerceCustomerUITest::testCommerceCustomerUIAccessCustomerProfileTypesListing in modules/customer/tests/commerce_customer_ui.test
Access to the customer profile types listing.
commerce_customer_commerce_checkout_pane_info in modules/customer/commerce_customer.module
Implements hook_commerce_checkout_pane_info().
commerce_customer_configure_customer_types in modules/customer/commerce_customer.module
Configures customer profile types defined by enabled modules.
commerce_customer_field_delete_instance in modules/customer/commerce_customer.module
Implements hook_field_delete_instance().
commerce_customer_handler_filter_customer_profile_type::get_value_options in modules/customer/includes/views/handlers/commerce_customer_handler_filter_customer_profile_type.inc
Child classes should be used to override this function and set the 'value options', unless 'options callback' is defined as a valid function or static public method to generate these values.

... See full list

1 string reference to 'commerce_customer_profile_types'
commerce_customer_profile_types_reset in modules/customer/commerce_customer.module
Resets the cached list of customer profile types.

File

modules/customer/commerce_customer.module, line 464
Defines the customer profile entity and API functions to manage customers and interact with them.

Code

function commerce_customer_profile_types() {

  // First check the static cache for a profile types array.
  $profile_types =& drupal_static(__FUNCTION__);

  // If it did not exist, fetch the types now.
  if (!isset($profile_types)) {
    $profile_types = array();

    // Find profile types defined by hook_commerce_customer_profile_type_info().
    foreach (module_implements('commerce_customer_profile_type_info') as $module) {
      foreach (module_invoke($module, 'commerce_customer_profile_type_info') as $type => $profile_type) {

        // Initialize customer profile type properties if necessary.
        $defaults = array(
          'description' => '',
          'help' => '',
          'addressfield' => TRUE,
          'module' => $module,
          'label_callback' => 'commerce_customer_profile_default_label',
        );
        $profile_types[$type] = array_merge($defaults, $profile_type);
      }
    }

    // Last allow the info to be altered by other modules.
    drupal_alter('commerce_customer_profile_type_info', $profile_types);
  }
  return $profile_types;
}