function commerce_tax_types in Commerce Core 7
Returns an array of tax type objects keyed by name.
9 calls to commerce_tax_types()
- CommerceTaxUIAdminTest::testCommerceTaxUIAccessTaxTypes in modules/
tax/ tests/ commerce_tax_ui.test - Test access to tax types listing.
- CommerceTaxUIAdminTest::testCommerceTaxUICreateTaxRate in modules/
tax/ tests/ commerce_tax_ui.test - Test the creation of a tax rate.
- commerce_tax_default_rules_configuration in modules/
tax/ commerce_tax.rules_defaults.inc - Implements hook_default_rules_configuration().
- commerce_tax_field_widget_form_alter in modules/
tax/ commerce_tax.module - Implements hook_field_widget_form_alter().
- commerce_tax_rules_action_info in modules/
tax/ commerce_tax.rules.inc - Implements hook_rules_action_info().
1 string reference to 'commerce_tax_types'
- commerce_tax_types_reset in modules/
tax/ commerce_tax.module - Resets the cached list of tax types.
File
- modules/
tax/ commerce_tax.module, line 56 - Defines tax rates and Rules integration for configuring tax rules for applicability and display.
Code
function commerce_tax_types() {
// First check the static cache for a tax types array.
$tax_types =& drupal_static(__FUNCTION__);
// If it did not exist, fetch the types now.
if (!isset($tax_types)) {
$tax_types = array();
// Find tax types defined by hook_commerce_tax_type_info().
foreach (module_implements('commerce_tax_type_info') as $module) {
foreach (module_invoke($module, 'commerce_tax_type_info') as $name => $tax_type) {
// Initialize tax rate properties if necessary.
$defaults = array(
'name' => $name,
'display_title' => $tax_type['title'],
'description' => '',
'display_inclusive' => FALSE,
'round_mode' => COMMERCE_ROUND_NONE,
'rule' => 'commerce_tax_type_' . $name,
'module' => $module,
);
$tax_types[$name] = array_merge($defaults, $tax_type);
}
}
// Last allow the info to be altered by other modules.
drupal_alter('commerce_tax_type_info', $tax_types);
}
return $tax_types;
}