function commerce_discount_commerce_discount_update in Commerce Discount 7
Implements hook_commerce_discount_update().
Rebuild Rules configuration.
File
- ./
commerce_discount.module, line 393 - Defines the discount and discount offer entities, bundles and functionality.
Code
function commerce_discount_commerce_discount_update($entity) {
if (module_exists('i18n_string')) {
// Account for name changes.
if ($entity->original->name != $entity->name) {
i18n_string_update_context("commerce_discount:commerce_discount:" . $entity->original->name . ":component_title", "commerce_discount:commerce_discount:" . $entity->name . ":component_title");
}
i18n_string_object_update('commerce_discount', $entity);
}
// We need to reload the discount afresh because some fields contain
// serialized and empty values.
$discount = entity_load_single('commerce_discount', $entity->discount_id);
_commerce_discount_rebuild_rules_config(array(
clone $discount,
));
}