You are here

function commerce_customer_commerce_checkout_pane_info in Commerce Core 7

Implements hook_commerce_checkout_pane_info().

File

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

Code

function commerce_customer_commerce_checkout_pane_info() {
  $checkout_panes = array();
  $weight = 5;
  foreach (commerce_customer_profile_types() as $type => $profile_type) {

    // Get instance data for the customer profile reference field.
    $field_name = variable_get('commerce_customer_profile_' . $type . '_field', '');
    $instance = field_info_instance('commerce_order', $field_name, 'commerce_order');
    $translated_instance = commerce_i18n_object('field_instance', $instance);
    $checkout_panes['customer_profile_' . $type] = array(
      'title' => !empty($instance['label']) ? $translated_instance['label'] : $profile_type['name'],
      'file' => 'includes/commerce_customer.checkout_pane.inc',
      'base' => 'commerce_customer_profile_pane',
      'page' => !empty($instance) ? 'checkout' : 'disabled',
      'locked' => empty($instance),
      'weight' => isset($profile_type['checkout_pane_weight']) ? $profile_type['checkout_pane_weight'] : $weight++,
    );
  }
  return $checkout_panes;
}