You are here

function commerce_discount_update_7101 in Commerce Discount 7

Update the widget type of field commerce_discount_offer.

See also

https://drupal.org/node/1875524

File

./commerce_discount.install, line 781
Install, update, and uninstall functions for the commerce discount module.

Code

function commerce_discount_update_7101() {
  $instances = field_info_instances('commerce_discount');
  foreach ($instances as $bundle => $bundle_instances) {
    foreach ($bundle_instances as $field_name => $instance) {
      if ($field_name == 'commerce_discount_offer') {
        $instance['widget']['type'] = 'inline_entity_form_single';
        field_update_instance($instance);
      }
    }
  }
}