You are here

function commerce_line_item_entity_property_info_alter in Commerce Core 7

Implements hook_entity_property_info_alter() on top of the Line Item module.

File

modules/line_item/commerce_line_item.info.inc, line 97
Provides metadata for the line item entity.

Code

function commerce_line_item_entity_property_info_alter(&$info) {

  // Move the price properties to the line item by default; as they are required
  // default fields, this makes dealing with them more convenient.
  $properties = array();
  foreach ($info['commerce_line_item']['bundles'] as $bundle => $bundle_info) {
    $bundle_info += array(
      'properties' => array(),
    );
    $properties += $bundle_info['properties'];
  }
  if (!empty($properties['commerce_unit_price'])) {
    $info['commerce_line_item']['properties']['commerce_unit_price'] = $properties['commerce_unit_price'];
  }
  if (!empty($properties['commerce_total'])) {
    $info['commerce_line_item']['properties']['commerce_total'] = $properties['commerce_total'];
  }
}