function commerce_price_component_load in Commerce Core 7
Returns every component of a particular type from a price's data array.
Parameters
$price: The price array to load components from.
$type: The machine-name of the component type to load.
Return value
An array of components from the data array matching the type.
8 calls to commerce_price_component_load()
- CommerceTaxUIAdminTest::testCommerceTaxUIAdminOrder in modules/
tax/ tests/ commerce_tax_ui.test - Check the taxes applied in the order admin view.
- CommerceTaxUIAdminTest::testCommerceTaxUIApplySalesTax in modules/
tax/ tests/ commerce_tax_ui.test - Check if a 'Salex tax' rate is correctly applied in a given order.
- CommerceTaxUIAdminTest::testCommerceTaxUIApplyVAT in modules/
tax/ tests/ commerce_tax_ui.test - Check if a 'VAT' tax type is correctly applied in a given product.
- CommerceTaxUIAdminTest::testCommerceTaxUIApplyVATInclusive in modules/
tax/ tests/ commerce_tax_ui.test - Check if a 'VAT' tax type is correctly applied in a given product.
- CommerceTaxUIAdminTest::testCommerceTaxUITaxNoMatchingCondition in modules/
tax/ tests/ commerce_tax_ui.test - A tax rate with no matching condition doesn't get applied.
File
- modules/
price/ commerce_price.module, line 985 - Defines the Price field with widgets and formatters used to add prices with currency codes to various Commerce entities.
Code
function commerce_price_component_load($price, $type) {
$components = array();
if (!empty($price['data']['components'])) {
foreach ($price['data']['components'] as $key => $component) {
if ($component['name'] == $type) {
$components[] = $component;
}
}
}
return $components;
}