Révision 9d13637e
Ajouté par Assos Assos il y a plus de 9 ans
drupal7/sites/all/modules/commerce/modules/line_item/commerce_line_item.info.inc | ||
---|---|---|
81 | 81 |
'schema field' => 'changed', |
82 | 82 |
); |
83 | 83 |
|
84 |
$info['commerce_line_item']['bundles'] = array(); |
|
85 |
foreach (commerce_line_item_type_get_name() as $type => $name) { |
|
86 |
$info['commerce_line_item']['bundles'][$type] = array( |
|
87 |
'label' => $name, |
|
88 |
); |
|
89 |
} |
|
90 |
|
|
84 | 91 |
return $info; |
85 | 92 |
} |
86 | 93 |
|
... | ... | |
88 | 95 |
* Implements hook_entity_property_info_alter() on top of the Line Item module. |
89 | 96 |
*/ |
90 | 97 |
function commerce_line_item_entity_property_info_alter(&$info) { |
91 |
if (!empty($info['commerce_line_item']['bundles'])) { |
|
92 |
// Move the price properties to the line item by default; as they are required |
|
93 |
// default fields, this makes dealing with them more convenient. |
|
94 |
$properties = array(); |
|
98 |
// Move the price properties to the line item by default; as they are required |
|
99 |
// default fields, this makes dealing with them more convenient. |
|
100 |
$properties = array(); |
|
95 | 101 |
|
96 |
foreach ($info['commerce_line_item']['bundles'] as $bundle => $bundle_info) {
|
|
97 |
$bundle_info += array('properties' => array());
|
|
98 |
$properties += $bundle_info['properties'];
|
|
99 |
}
|
|
102 |
foreach ($info['commerce_line_item']['bundles'] as $bundle => $bundle_info) { |
|
103 |
$bundle_info += array('properties' => array()); |
|
104 |
$properties += $bundle_info['properties']; |
|
105 |
} |
|
100 | 106 |
|
107 |
if (!empty($properties['commerce_unit_price'])) { |
|
101 | 108 |
$info['commerce_line_item']['properties']['commerce_unit_price'] = $properties['commerce_unit_price']; |
109 |
} |
|
110 |
if (!empty($properties['commerce_total'])) { |
|
102 | 111 |
$info['commerce_line_item']['properties']['commerce_total'] = $properties['commerce_total']; |
103 | 112 |
} |
104 | 113 |
} |
Formats disponibles : Unified diff
Weekly update of contrib modules