You are here

function bundle_inherit_field_update_instance in Bundle Inherit 7

Implements hook_field_update_instance().

File

./bundle_inherit.module, line 76
Bundle Inherit module.

Code

function bundle_inherit_field_update_instance($instance, $prior_instance) {
  $children = bundle_inherit_bundle_get_children($prior_instance['entity_type'], $prior_instance['bundle']);
  foreach ($children as $bundle) {
    $old_instance = field_info_instance($instance['entity_type'], $instance['field_name'], $bundle['type']);
    $new_instance = array(
      'id' => $old_instance['id'],
      'bundle' => $old_instance['bundle'],
      'locked' => TRUE,
    );
    $new_instance += $instance;
    field_update_instance($new_instance);
  }
}