You are here

function commerce_order_configure_order_fields in Commerce Core 7

Configures the customer profile reference fields attached to the default order type when modules defining customer profile types are enabled after the Order module.

Parameters

$modules: An array of module names whose customer profile reference fields should be configured; if left NULL, will default to all modules that implement hook_commerce_customer_profile_type_info().

1 call to commerce_order_configure_order_fields()
commerce_order_modules_enabled in modules/order/commerce_order.module
Implements hook_modules_enabled().

File

modules/order/commerce_order.module, line 282
Defines the core Commerce order entity and API functions to manage orders and interact with them.

Code

function commerce_order_configure_order_fields($modules = NULL) {

  // If no modules array is passed, recheck the customer profile reference
  // fields to all customer profile types defined by enabled modules.
  if (empty($modules)) {
    $modules = module_implements('commerce_customer_profile_type_info');
  }

  // Loop through all the enabled modules.
  foreach ($modules as $module) {

    // If the module implements hook_commerce_customer_profile_type_info()...
    if (module_hook($module, 'commerce_customer_profile_type_info')) {
      $profile_types = module_invoke($module, 'commerce_customer_profile_type_info');

      // Loop through and configure its customer profile types.
      foreach ($profile_types as $profile_type) {
        commerce_order_configure_customer_profile_type($profile_type['type'], $profile_type['name']);
      }
    }
  }
}