You are here

function commerce_order_entity_property_info_alter in Commerce Core 7

Implements hook_entity_property_info_alter() on top of the Order module.

File

modules/order/commerce_order.info.inc, line 136
Provides metadata for the order entity.

Code

function commerce_order_entity_property_info_alter(&$info) {

  // Move the line items and order total properties to the order by default; as
  // they are required default fields, this makes dealing with them more convenient.
  $properties = array();
  foreach ($info['commerce_order']['bundles'] as $bundle => $bundle_info) {
    $bundle_info += array(
      'properties' => array(),
    );
    $properties += $bundle_info['properties'];
  }
  if (!empty($properties['commerce_line_items'])) {
    $info['commerce_order']['properties']['commerce_line_items'] = $properties['commerce_line_items'];
  }
  if (!empty($properties['commerce_order_total'])) {
    $info['commerce_order']['properties']['commerce_order_total'] = $properties['commerce_order_total'];
  }
}