You are here

function _commerce_payment_default_rules_reset in Commerce Core 7

Resets default Rules if necessary when modules are enabled or disabled.

Parameters

$modules: An array of module names that have been enabled or disabled.

1 call to _commerce_payment_default_rules_reset()
commerce_payment_modules_enabled in modules/payment/commerce_payment.module
Implements hook_modules_enabled().

File

modules/payment/commerce_payment.module, line 258
Defines the payment system and checkout integration.

Code

function _commerce_payment_default_rules_reset($modules) {
  $reset_default_rules = FALSE;

  // Look for any module defining a new payment method.
  foreach ($modules as $module) {
    if (function_exists($module . '_commerce_payment_method_info')) {
      $reset_default_rules = TRUE;
    }
  }

  // If we found a module defining a new payment method, we need to rebuild the
  // default Rules especially for this module so the default payment method Rule
  // will appear properly for this module.
  if ($reset_default_rules) {
    entity_defaults_rebuild();
    rules_clear_cache(TRUE);
  }
}