function commerce_price_component_types in Commerce Core 7
Returns a list of all available price component types.
2 calls to commerce_price_component_types()
- commerce_price_component_titles in modules/
price/ commerce_price.module - Returns an array of price component type titles keyed by name.
- commerce_price_component_type_load in modules/
price/ commerce_price.module - Returns a component type array.
File
- modules/
price/ commerce_price.module, line 886 - Defines the Price field with widgets and formatters used to add prices with currency codes to various Commerce entities.
Code
function commerce_price_component_types() {
// First check the static cache for a components array.
$component_types =& drupal_static(__FUNCTION__);
// If it did not exist, fetch the types now.
if (!isset($component_types)) {
// Find components defined by hook_commerce_price_component_type_info().
$component_types = module_invoke_all('commerce_price_component_type_info');
// Add default values to the component type definitions.
foreach ($component_types as $name => &$component_type) {
$component_type += array(
'name' => $name,
'display_title' => $component_type['title'],
'weight' => 0,
);
}
// Allow the info to be altered by other modules.
drupal_alter('commerce_price_component_type_info', $component_types);
}
return $component_types;
}